Skip to content

Commit

Permalink
Code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
buffer committed Apr 10, 2024
1 parent 5e16c89 commit ad92aa7
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 94 deletions.
2 changes: 1 addition & 1 deletion tests/Encoding/test_Encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_unicode(self):
assert result["encoding"] in ("ascii",)

def test_utf8_bom(self):
result = encoding.detect(b"\xEF\xBB\xBF")
result = encoding.detect(b"\xef\xbb\xbf")
assert result["encoding"] in ("UTF-8-SIG",)

def test_unicode_utf8(self):
Expand Down
5 changes: 3 additions & 2 deletions tests/Logging/modules/test_MongoDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ class TestMongoDB:
con_method = "iframe"

# Creating a MongoDB object for all the test methods.
with patch(pymongo.__name__ + ".MongoClient", new=mongomock.MongoClient), patch(
"gridfs.Database", new=mongomock.database.Database
with (
patch(pymongo.__name__ + ".MongoClient", new=mongomock.MongoClient),
patch("gridfs.Database", new=mongomock.database.Database),
):
log.ThugOpts.mongodb_address = "mongodb://localhost:123"
mongo = MongoDB()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@


def Deserialize_2(self, buf):
log.ThugLogging.add_behavior_warn("[System.Runtime.Serialization.Formatters.Binary.BinaryFormatter] Deserialize_2")
log.ThugLogging.add_behavior_warn(
"[System.Runtime.Serialization.Formatters.Binary.BinaryFormatter] Deserialize_2"
)

data = buf.stream.getvalue()
return Delegate(data)
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@


def TransformFinalBlock(self, buffer, offset, count):
log.ThugLogging.add_behavior_warn("[System.Security.Cryptography.FromBase64ToTransform] TransformFinalBlock")
log.ThugLogging.add_behavior_warn(
"[System.Security.Cryptography.FromBase64ToTransform] TransformFinalBlock"
)
return bytes(base64.b64decode("".join(buffer[offset : offset + count])))
4 changes: 3 additions & 1 deletion thug/ActiveX/modules/System/Text/ASCIIEncoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

def GetByteCount_2(self, chars):
count = len(chars.encode("utf-8"))
log.ThugLogging.add_behavior_warn(f"[System.Text.ASCIIEncoding] GetByteCount_2 count = {count}")
log.ThugLogging.add_behavior_warn(
f"[System.Text.ASCIIEncoding] GetByteCount_2 count = {count}"
)
return count


Expand Down
174 changes: 87 additions & 87 deletions thug/DOM/JScriptEncode.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@


DDECODE = {}
DDECODE[9] = "\x57\x6E\x7B"
DDECODE[10] = "\x4A\x4C\x41"
DDECODE[11] = "\x0B\x0B\x0B"
DDECODE[12] = "\x0C\x0C\x0C"
DDECODE[13] = "\x4A\x4C\x41"
DDECODE[14] = "\x0E\x0E\x0E"
DDECODE[15] = "\x0F\x0F\x0F"
DDECODE[9] = "\x57\x6e\x7b"
DDECODE[10] = "\x4a\x4c\x41"
DDECODE[11] = "\x0b\x0b\x0b"
DDECODE[12] = "\x0c\x0c\x0c"
DDECODE[13] = "\x4a\x4c\x41"
DDECODE[14] = "\x0e\x0e\x0e"
DDECODE[15] = "\x0f\x0f\x0f"
DDECODE[16] = "\x10\x10\x10"
DDECODE[17] = "\x11\x11\x11"
DDECODE[18] = "\x12\x12\x12"
Expand All @@ -24,107 +24,107 @@
DDECODE[23] = "\x17\x17\x17"
DDECODE[24] = "\x18\x18\x18"
DDECODE[25] = "\x19\x19\x19"
DDECODE[26] = "\x1A\x1A\x1A"
DDECODE[27] = "\x1B\x1B\x1B"
DDECODE[28] = "\x1C\x1C\x1C"
DDECODE[29] = "\x1D\x1D\x1D"
DDECODE[30] = "\x1E\x1E\x1E"
DDECODE[31] = "\x1F\x1F\x1F"
DDECODE[32] = "\x2E\x2D\x32"
DDECODE[26] = "\x1a\x1a\x1a"
DDECODE[27] = "\x1b\x1b\x1b"
DDECODE[28] = "\x1c\x1c\x1c"
DDECODE[29] = "\x1d\x1d\x1d"
DDECODE[30] = "\x1e\x1e\x1e"
DDECODE[31] = "\x1f\x1f\x1f"
DDECODE[32] = "\x2e\x2d\x32"
DDECODE[33] = "\x47\x75\x30"
DDECODE[34] = "\x7A\x52\x21"
DDECODE[34] = "\x7a\x52\x21"
DDECODE[35] = "\x56\x60\x29"
DDECODE[36] = "\x42\x71\x5B"
DDECODE[37] = "\x6A\x5E\x38"
DDECODE[38] = "\x2F\x49\x33"
DDECODE[39] = "\x26\x5C\x3D"
DDECODE[36] = "\x42\x71\x5b"
DDECODE[37] = "\x6a\x5e\x38"
DDECODE[38] = "\x2f\x49\x33"
DDECODE[39] = "\x26\x5c\x3d"
DDECODE[40] = "\x49\x62\x58"
DDECODE[41] = "\x41\x7D\x3A"
DDECODE[41] = "\x41\x7d\x3a"
DDECODE[42] = "\x34\x29\x35"
DDECODE[43] = "\x32\x36\x65"
DDECODE[44] = "\x5B\x20\x39"
DDECODE[45] = "\x76\x7C\x5C"
DDECODE[46] = "\x72\x7A\x56"
DDECODE[47] = "\x43\x7F\x73"
DDECODE[48] = "\x38\x6B\x66"
DDECODE[49] = "\x39\x63\x4E"
DDECODE[44] = "\x5b\x20\x39"
DDECODE[45] = "\x76\x7c\x5c"
DDECODE[46] = "\x72\x7a\x56"
DDECODE[47] = "\x43\x7f\x73"
DDECODE[48] = "\x38\x6b\x66"
DDECODE[49] = "\x39\x63\x4e"
DDECODE[50] = "\x70\x33\x45"
DDECODE[51] = "\x45\x2B\x6B"
DDECODE[51] = "\x45\x2b\x6b"
DDECODE[52] = "\x68\x68\x62"
DDECODE[53] = "\x71\x51\x59"
DDECODE[54] = "\x4F\x66\x78"
DDECODE[55] = "\x09\x76\x5E"
DDECODE[56] = "\x62\x31\x7D"
DDECODE[57] = "\x44\x64\x4A"
DDECODE[58] = "\x23\x54\x6D"
DDECODE[54] = "\x4f\x66\x78"
DDECODE[55] = "\x09\x76\x5e"
DDECODE[56] = "\x62\x31\x7d"
DDECODE[57] = "\x44\x64\x4a"
DDECODE[58] = "\x23\x54\x6d"
DDECODE[59] = "\x75\x43\x71"
DDECODE[60] = "\x4A\x4C\x41"
DDECODE[61] = "\x7E\x3A\x60"
DDECODE[62] = "\x4A\x4C\x41"
DDECODE[63] = "\x5E\x7E\x53"
DDECODE[64] = "\x40\x4C\x40"
DDECODE[60] = "\x4a\x4c\x41"
DDECODE[61] = "\x7e\x3a\x60"
DDECODE[62] = "\x4a\x4c\x41"
DDECODE[63] = "\x5e\x7e\x53"
DDECODE[64] = "\x40\x4c\x40"
DDECODE[65] = "\x77\x45\x42"
DDECODE[66] = "\x4A\x2C\x27"
DDECODE[67] = "\x61\x2A\x48"
DDECODE[68] = "\x5D\x74\x72"
DDECODE[66] = "\x4a\x2c\x27"
DDECODE[67] = "\x61\x2a\x48"
DDECODE[68] = "\x5d\x74\x72"
DDECODE[69] = "\x22\x27\x75"
DDECODE[70] = "\x4B\x37\x31"
DDECODE[71] = "\x6F\x44\x37"
DDECODE[72] = "\x4E\x79\x4D"
DDECODE[73] = "\x3B\x59\x52"
DDECODE[74] = "\x4C\x2F\x22"
DDECODE[75] = "\x50\x6F\x54"
DDECODE[76] = "\x67\x26\x6A"
DDECODE[77] = "\x2A\x72\x47"
DDECODE[78] = "\x7D\x6A\x64"
DDECODE[79] = "\x74\x39\x2D"
DDECODE[80] = "\x54\x7B\x20"
DDECODE[81] = "\x2B\x3F\x7F"
DDECODE[82] = "\x2D\x38\x2E"
DDECODE[83] = "\x2C\x77\x4C"
DDECODE[84] = "\x30\x67\x5D"
DDECODE[85] = "\x6E\x53\x7E"
DDECODE[86] = "\x6B\x47\x6C"
DDECODE[87] = "\x66\x34\x6F"
DDECODE[70] = "\x4b\x37\x31"
DDECODE[71] = "\x6f\x44\x37"
DDECODE[72] = "\x4e\x79\x4d"
DDECODE[73] = "\x3b\x59\x52"
DDECODE[74] = "\x4c\x2f\x22"
DDECODE[75] = "\x50\x6f\x54"
DDECODE[76] = "\x67\x26\x6a"
DDECODE[77] = "\x2a\x72\x47"
DDECODE[78] = "\x7d\x6a\x64"
DDECODE[79] = "\x74\x39\x2d"
DDECODE[80] = "\x54\x7b\x20"
DDECODE[81] = "\x2b\x3f\x7f"
DDECODE[82] = "\x2d\x38\x2e"
DDECODE[83] = "\x2c\x77\x4c"
DDECODE[84] = "\x30\x67\x5d"
DDECODE[85] = "\x6e\x53\x7e"
DDECODE[86] = "\x6b\x47\x6c"
DDECODE[87] = "\x66\x34\x6f"
DDECODE[88] = "\x35\x78\x79"
DDECODE[89] = "\x25\x5D\x74"
DDECODE[89] = "\x25\x5d\x74"
DDECODE[90] = "\x21\x30\x43"
DDECODE[91] = "\x64\x23\x26"
DDECODE[92] = "\x4D\x5A\x76"
DDECODE[93] = "\x52\x5B\x25"
DDECODE[94] = "\x63\x6C\x24"
DDECODE[95] = "\x3F\x48\x2B"
DDECODE[96] = "\x7B\x55\x28"
DDECODE[92] = "\x4d\x5a\x76"
DDECODE[93] = "\x52\x5b\x25"
DDECODE[94] = "\x63\x6c\x24"
DDECODE[95] = "\x3f\x48\x2b"
DDECODE[96] = "\x7b\x55\x28"
DDECODE[97] = "\x78\x70\x23"
DDECODE[98] = "\x29\x69\x41"
DDECODE[99] = "\x28\x2E\x34"
DDECODE[100] = "\x73\x4C\x09"
DDECODE[101] = "\x59\x21\x2A"
DDECODE[99] = "\x28\x2e\x34"
DDECODE[100] = "\x73\x4c\x09"
DDECODE[101] = "\x59\x21\x2a"
DDECODE[102] = "\x33\x24\x44"
DDECODE[103] = "\x7F\x4E\x3F"
DDECODE[104] = "\x6D\x50\x77"
DDECODE[105] = "\x55\x09\x3B"
DDECODE[103] = "\x7f\x4e\x3f"
DDECODE[104] = "\x6d\x50\x77"
DDECODE[105] = "\x55\x09\x3b"
DDECODE[106] = "\x53\x56\x55"
DDECODE[107] = "\x7C\x73\x69"
DDECODE[108] = "\x3A\x35\x61"
DDECODE[109] = "\x5F\x61\x63"
DDECODE[110] = "\x65\x4B\x50"
DDECODE[107] = "\x7c\x73\x69"
DDECODE[108] = "\x3a\x35\x61"
DDECODE[109] = "\x5f\x61\x63"
DDECODE[110] = "\x65\x4b\x50"
DDECODE[111] = "\x46\x58\x67"
DDECODE[112] = "\x58\x3B\x51"
DDECODE[112] = "\x58\x3b\x51"
DDECODE[113] = "\x31\x57\x49"
DDECODE[114] = "\x69\x22\x4F"
DDECODE[115] = "\x6C\x6D\x46"
DDECODE[116] = "\x5A\x4D\x68"
DDECODE[117] = "\x48\x25\x7C"
DDECODE[114] = "\x69\x22\x4f"
DDECODE[115] = "\x6c\x6d\x46"
DDECODE[116] = "\x5a\x4d\x68"
DDECODE[117] = "\x48\x25\x7c"
DDECODE[118] = "\x27\x28\x36"
DDECODE[119] = "\x5C\x46\x70"
DDECODE[120] = "\x3D\x4A\x6E"
DDECODE[121] = "\x24\x32\x7A"
DDECODE[122] = "\x79\x41\x2F"
DDECODE[123] = "\x37\x3D\x5F"
DDECODE[124] = "\x60\x5F\x4B"
DDECODE[125] = "\x51\x4F\x5A"
DDECODE[126] = "\x20\x42\x2C"
DDECODE[119] = "\x5c\x46\x70"
DDECODE[120] = "\x3d\x4a\x6e"
DDECODE[121] = "\x24\x32\x7a"
DDECODE[122] = "\x79\x41\x2f"
DDECODE[123] = "\x37\x3d\x5f"
DDECODE[124] = "\x60\x5f\x4b"
DDECODE[125] = "\x51\x4f\x5a"
DDECODE[126] = "\x20\x42\x2c"
DDECODE[127] = "\x36\x65\x57"

DCOMBINATION = {}
Expand Down
2 changes: 1 addition & 1 deletion tools/distributed/thugctrl.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
""" Thug Control
"""Thug Control
Send commands to Thug
Expand Down

0 comments on commit ad92aa7

Please sign in to comment.