private void DiveByteSimple(ByteString candidate, int level, int searchLength, int currentUtf8Value = 0) { int levelp = level + 1; byte[] charsetBytes; if (currentUtf8Value > 127 && _mappingBytes.ContainsKey(currentUtf8Value)) { charsetBytes = _mappingBytes[currentUtf8Value]; } else { charsetBytes = _validBytes; currentUtf8Value = 0; } foreach (byte b in charsetBytes) { if (levelp < searchLength) { candidate.Append(b); DiveByteSimple(candidate, levelp, searchLength, (currentUtf8Value << 8) + b); candidate.Cursor -= 1; continue; } candidate.Replace(b); if (candidate.CRC32Check()) { _logger.LogResult(candidate.ToString()); } } }
private void DiveByteSimple(ByteString candidate, int level, int searchLength, bool shouldInterruptAtFirstResult = false) { int levelp = level + 1; foreach (byte b in _validBytes) { if (_interruptThreads) { break; } if (levelp < searchLength) { candidate.Append(b); DiveByteSimple(candidate, levelp, searchLength, shouldInterruptAtFirstResult); candidate.Cursor -= 1; continue; } candidate.Replace(b); if (candidate.CRC32Check()) { if (shouldInterruptAtFirstResult) { _logger.LogResult($"False positive found: 0x{candidate.HexSearchValue:x}."); _hexExtract = candidate.HexSearchValue; _interruptThreads = true; } else { _logger.LogResult(candidate.ToString()); } } } }
private void DiveByteSimple(ByteString candidate, int level, int searchLength) { int levelp = level + 1; foreach (byte b in _validBytes) { if (levelp < searchLength) { candidate.Append(b); DiveByteSimple(candidate, levelp, searchLength); candidate.Cursor -= 1; continue; } candidate.Replace(b); if (candidate.CRC32Check()) { _logger.LogResult(candidate.ToString()); } } }
private void DiveByte(ByteString candidate, int level, int searchLength, int[] levelTable, int patternPosition) { int levelp = level + levelTable[level]; foreach (byte b in _validBytes) { if (levelp < searchLength) { candidate.Replace(b); candidate.Cursor += levelTable[level]; DiveByte(candidate, levelp, searchLength, levelTable, patternPosition); candidate.Cursor -= levelTable[level]; continue; } candidate.Replace(b); if (candidate.CRC32Check()) { _logger.LogResult(candidate.ToString()); } } }