Ejemplo n.º 1
0
  /**
   * Get the sub-String until the character is encountered
   *
   * @param c the character to match
   * @return the substring that matches.
   */
  @DSSource({DSSourceKind.SENSITIVE_UNCATEGORIZED})
  @DSGenerator(
      tool_name = "Doppelganger",
      tool_version = "2.0",
      generated_on = "2013-12-30 12:55:51.018 -0500",
      hash_original_method = "720A9C8698AD8EBEF63DE1F048944846",
      hash_generated_method = "280573BDFBE88FEAE20614843D1D4CAB")
  public String getString(char c) throws ParseException {
    StringBuffer retval = new StringBuffer();
    while (true) {
      char next = lookAhead(0);
      // System.out.println(" next = [" + next + ']' + "ptr = " + ptr);
      // System.out.println(next == '\0');

      if (next == '\0') {
        throw new ParseException(this.buffer + "unexpected EOL", this.ptr);
      } else if (next == c) {
        consume(1);
        break;
      } else if (next == '\\') {
        consume(1);
        char nextchar = lookAhead(0);
        if (nextchar == '\0') {
          throw new ParseException(this.buffer + "unexpected EOL", this.ptr);
        } else {
          consume(1);
          retval.append(nextchar);
        }
      } else {
        consume(1);
        retval.append(next);
      }
    }
    return retval.toString();
  }
Ejemplo n.º 2
0
 /**
  * Parse a comment string cursor is at a "(". Leave cursor at )
  *
  * @return the substring containing the comment excluding the closing brace.
  */
 @DSGenerator(
     tool_name = "Doppelganger",
     tool_version = "2.0",
     generated_on = "2013-12-30 12:55:50.992 -0500",
     hash_original_method = "0DEFD663D479F88E7A114CE703AF8835",
     hash_generated_method = "468767B16106E3DDBED1803029F31BE7")
 public String comment() throws ParseException {
   StringBuffer retval = new StringBuffer();
   if (lookAhead(0) != '(') return null;
   consume(1);
   while (true) {
     char next = getNextChar();
     if (next == ')') {
       break;
     } else if (next == '\0') {
       throw new ParseException(this.buffer + " :unexpected EOL", this.ptr);
     } else if (next == '\\') {
       retval.append(next);
       next = getNextChar();
       if (next == '\0') throw new ParseException(this.buffer + " : unexpected EOL", this.ptr);
       retval.append(next);
     } else {
       retval.append(next);
     }
   }
   return retval.toString();
 }
Ejemplo n.º 3
0
  /**
   * This function creates a directive record and adds it to the list, the value will be added later
   * after it is parsed.
   *
   * @param name Name
   * @param haveQuotedPair true if quoted pair is there else false
   */
  @DSGenerator(
      tool_name = "Doppelganger",
      tool_version = "2.0",
      generated_on = "2014-09-03 15:02:38.406 -0400",
      hash_original_method = "266E87F8A828CDA30627CAA7433FF646",
      hash_generated_method = "CE03EAF7EDFB05F294B401E410CDC667")
  void addDirective(String name, boolean haveQuotedPair) {
    String value;
    int inputIndex;
    int valueIndex;
    char valueChar;
    int type;

    if (!haveQuotedPair) {
      value = m_directives.substring(m_scanStart, m_curPos);
    } else { // copy one character at a time skipping backslash excapes.
      StringBuffer valueBuf = new StringBuffer(m_curPos - m_scanStart);
      valueIndex = 0;
      inputIndex = m_scanStart;
      while (inputIndex < m_curPos) {
        if ('\\' == (valueChar = m_directives.charAt(inputIndex))) inputIndex++;
        valueBuf.setCharAt(valueIndex, m_directives.charAt(inputIndex));
        valueIndex++;
        inputIndex++;
      }
      value = new String(valueBuf);
    }

    if (m_state == STATE_SCANNING_QUOTED_STRING_VALUE) type = ParsedDirective.QUOTED_STRING_VALUE;
    else type = ParsedDirective.TOKEN_VALUE;
    m_directiveList.add(new ParsedDirective(name, value, type));
  }
Ejemplo n.º 4
0
  @DSSource({DSSourceKind.NETWORK})
  @DSSafe(DSCat.SAFE_LIST)
  @DSGenerator(
      tool_name = "Doppelganger",
      tool_version = "2.0",
      generated_on = "2013-12-30 12:36:06.195 -0500",
      hash_original_method = "3BF3B5ECD6A260296AD88686E08D9EA2",
      hash_generated_method = "9D61867682DEAA67854014FC90C1C4CF")
  @Override
  public String toString() {
    StringBuffer sb = new StringBuffer();
    String none = "<none>";

    sb.append("SSID: ")
        .append(SSID == null ? none : SSID)
        .append(", BSSID: ")
        .append(BSSID == null ? none : BSSID)
        .append(", capabilities: ")
        .append(capabilities == null ? none : capabilities)
        .append(", level: ")
        .append(level)
        .append(", frequency: ")
        .append(frequency);

    return sb.toString();
  }
Ejemplo n.º 5
0
 @DSGenerator(
     tool_name = "Doppelganger",
     tool_version = "2.0",
     generated_on = "2013-12-30 12:55:00.789 -0500",
     hash_original_method = "BA99BEB4A81573E88FDC5269E1629A0E",
     hash_generated_method = "A3A46C572519B95CA3ECF6B08D2B973D")
 public StringBuffer encode(StringBuffer buffer) {
   buffer.append(localId);
   if (host != null) {
     buffer.append(AT).append(host);
   }
   return buffer;
 }
Ejemplo n.º 6
0
  @DSSink({DSSinkKind.SENSITIVE_UNCATEGORIZED})
  @DSGenerator(
      tool_name = "Doppelganger",
      tool_version = "2.0",
      generated_on = "2013-12-30 12:55:51.660 -0500",
      hash_original_method = "1BC6FB469729E22F0BBD9E3870285FA5",
      hash_generated_method = "543C9BD19E373DB533AA5A2550507AEF")
  protected void dbg_leave(String rule) {
    StringBuffer stringBuffer = new StringBuffer();
    for (int i = 0; i < nesting_level; i++) stringBuffer.append("<");

    if (debug) {
      System.out.println(stringBuffer + rule + "\nlexer buffer = \n" + lexer.getRest());
    }
    nesting_level--;
  }
Ejemplo n.º 7
0
  @DSSink({DSSinkKind.SENSITIVE_UNCATEGORIZED})
  @DSGenerator(
      tool_name = "Doppelganger",
      tool_version = "2.0",
      generated_on = "2013-12-30 12:55:51.657 -0500",
      hash_original_method = "FEF315A443660226B56655DBFD660360",
      hash_generated_method = "2CC809F5CB9762AB22FDDE770398FC72")
  protected void dbg_enter(String rule) {
    StringBuffer stringBuffer = new StringBuffer();
    for (int i = 0; i < nesting_level; i++) stringBuffer.append(">");

    if (debug) {
      System.out.println(stringBuffer + rule + "\nlexer buffer = \n" + lexer.getRest());
    }
    nesting_level++;
  }
Ejemplo n.º 8
0
 @DSSafe(DSCat.SAFE_LIST)
 @DSGenerator(
     tool_name = "Doppelganger",
     tool_version = "2.0",
     generated_on = "2013-12-30 12:36:02.372 -0500",
     hash_original_method = "D5529C8AE8D596D7C37EDA99E72A8446",
     hash_generated_method = "4462C98277D0907E61D3E2D1AB20C097")
 public String toString() {
   StringBuffer sbuf = new StringBuffer();
   sbuf.append("groupFormed: ")
       .append(groupFormed)
       .append("isGroupOwner: ")
       .append(isGroupOwner)
       .append("groupOwnerAddress: ")
       .append(groupOwnerAddress);
   return sbuf.toString();
 }
Ejemplo n.º 9
0
 /**
  * Return a substring containing no commas
  *
  * @return a substring containing no commas.
  */
 @DSGenerator(
     tool_name = "Doppelganger",
     tool_version = "2.0",
     generated_on = "2013-12-30 12:55:51.001 -0500",
     hash_original_method = "03994A77D1324F910A7EC2E8D4C779CB",
     hash_generated_method = "90ECE281F75BAE93DFEF4C3AA4D51FDF")
 public String byteStringNoComma() {
   StringBuffer retval = new StringBuffer();
   try {
     while (true) {
       char next = lookAhead(0);
       if (next == '\n' || next == ',') {
         break;
       } else {
         consume(1);
         retval.append(next);
       }
     }
   } catch (ParseException ex) {
   }
   return retval.toString();
 }
Ejemplo n.º 10
0
 /**
  * Scan until you see a slash or an EOL.
  *
  * @return substring containing no slash.
  */
 @DSGenerator(
     tool_name = "Doppelganger",
     tool_version = "2.0",
     generated_on = "2013-12-30 12:55:50.998 -0500",
     hash_original_method = "B2A0AA5C97E9078316CA6FEBE65DB0C3",
     hash_generated_method = "FE5A84F56F259ACFA9BFA9B919E878D5")
 public String byteStringNoSlash() {
   StringBuffer retval = new StringBuffer();
   try {
     while (true) {
       char next = lookAhead(0);
       // bug fix from Ben Evans.
       if (next == '\0' || next == '\n' || next == '/') {
         break;
       } else {
         consume(1);
         retval.append(next);
       }
     }
   } catch (ParseException ex) {
     return retval.toString();
   }
   return retval.toString();
 }
Ejemplo n.º 11
0
 /**
  * Return a substring containing no semicolons.
  *
  * @return a substring containing no semicolons.
  */
 @DSGenerator(
     tool_name = "Doppelganger",
     tool_version = "2.0",
     generated_on = "2013-12-30 12:55:50.995 -0500",
     hash_original_method = "86F26DE68AB39CE9DEE1E486630D72BD",
     hash_generated_method = "1D832A1960BD04E82C364D5311BD5FAE")
 public String byteStringNoSemicolon() {
   StringBuffer retval = new StringBuffer();
   try {
     while (true) {
       char next = lookAhead(0);
       // bug fix from Ben Evans.
       if (next == '\0' || next == '\n' || next == ';' || next == ',') {
         break;
       } else {
         consume(1);
         retval.append(next);
       }
     }
   } catch (ParseException ex) {
     return retval.toString();
   }
   return retval.toString();
 }