-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #377 from buffer/dotnet
[ActiveX] .NET Browser API
- Loading branch information
Showing
24 changed files
with
615 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import logging | ||
|
||
log = logging.getLogger("Thug") | ||
|
||
|
||
def Add(self, value): | ||
log.ThugLogging.add_behavior_warn("[System.Collections.ArrayList] Add") | ||
self.arraylist.append(value) | ||
return self.arraylist.index(value) | ||
|
||
|
||
def ToArray(self): | ||
log.ThugLogging.add_behavior_warn("[System.Collections.ArrayList] ToArray") | ||
return list(self.arraylist) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
__all__ = [ | ||
"ArrayList", | ||
] | ||
|
||
from . import ArrayList |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import io | ||
import logging | ||
|
||
log = logging.getLogger("Thug") | ||
|
||
|
||
def Write(self, buffer, offset=0, count=-1): | ||
log.ThugLogging.add_behavior_warn("[System.IO.MemoryStream] Write") | ||
|
||
buflen = count if count > -1 else len(buffer) | ||
bufdat = buffer[: buflen - 1] | ||
|
||
streamdata = self.stream.getvalue() | ||
data = f"{streamdata[:offset]}{bufdat}{streamdata[offset:]}" | ||
|
||
self.stream = io.BytesIO(data.encode()) | ||
self.Position = len(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
__all__ = [ | ||
"MemoryStream", | ||
] | ||
|
||
from . import MemoryStream |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class Activator: | ||
def __init__(self, delegate): | ||
self.delegate = delegate | ||
|
||
def CreateInstance(self, Type): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from .Activator import Activator | ||
|
||
|
||
class Delegate: | ||
def __init__(self, code): | ||
self.code = code | ||
|
||
def DynamicInvoke(self, args): | ||
return Activator(self) |
14 changes: 14 additions & 0 deletions
14
thug/ActiveX/modules/System/Runtime/Serialization/Formatters/Binary/BinaryFormatter.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import logging | ||
|
||
from thug.ActiveX.modules.System.Runtime.Delegate import Delegate | ||
|
||
log = logging.getLogger("Thug") | ||
|
||
|
||
def Deserialize_2(self, buf): | ||
log.ThugLogging.add_behavior_warn( | ||
"[System.Runtime.Serialization.Formatters.Binary.BinaryFormatter] Deserialize_2" | ||
) | ||
|
||
data = buf.stream.getvalue() | ||
return Delegate(data) |
5 changes: 5 additions & 0 deletions
5
thug/ActiveX/modules/System/Runtime/Serialization/Formatters/Binary/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
__all__ = [ | ||
"BinaryFormatter", | ||
] | ||
|
||
from . import BinaryFormatter |
5 changes: 5 additions & 0 deletions
5
thug/ActiveX/modules/System/Runtime/Serialization/Formatters/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
__all__ = [ | ||
"Binary", | ||
] | ||
|
||
from . import Binary |
5 changes: 5 additions & 0 deletions
5
thug/ActiveX/modules/System/Runtime/Serialization/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
__all__ = [ | ||
"Formatters", | ||
] | ||
|
||
from . import Formatters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
__all__ = [ | ||
"Serialization", | ||
] | ||
|
||
from . import Serialization |
11 changes: 11 additions & 0 deletions
11
thug/ActiveX/modules/System/Security/Cryptography/FromBase64Transform.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import base64 | ||
import logging | ||
|
||
log = logging.getLogger("Thug") | ||
|
||
|
||
def TransformFinalBlock(self, buffer, offset, count): | ||
log.ThugLogging.add_behavior_warn( | ||
"[System.Security.Cryptography.FromBase64ToTransform] TransformFinalBlock" | ||
) | ||
return bytes(base64.b64decode("".join(buffer[offset : offset + count]))) |
5 changes: 5 additions & 0 deletions
5
thug/ActiveX/modules/System/Security/Cryptography/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
__all__ = [ | ||
"FromBase64Transform", | ||
] | ||
|
||
from . import FromBase64Transform |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
__all__ = [ | ||
"Cryptography", | ||
] | ||
|
||
from . import Cryptography |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import logging | ||
|
||
log = logging.getLogger("Thug") | ||
|
||
|
||
def GetByteCount_2(self, chars): | ||
count = len(chars.encode("utf-8")) | ||
log.ThugLogging.add_behavior_warn( | ||
f"[System.Text.ASCIIEncoding] GetByteCount_2 count = {count}" | ||
) | ||
return count | ||
|
||
|
||
def GetBytes_4(self, chars): | ||
log.ThugLogging.add_behavior_warn("[System.Text.ASCIIEncoding] GetBytes_4") | ||
return list(chars) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
__all__ = [ | ||
"ASCIIEncoding", | ||
] | ||
|
||
from . import ASCIIEncoding |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
__all__ = ["Collections", "IO", "Runtime", "Security", "Text"] | ||
|
||
from . import Collections | ||
from . import IO | ||
from . import Runtime | ||
from . import Security | ||
from . import Text |
Oops, something went wrong.