Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import PyInstaller.__main__

if __name__ == "__main__":
PyInstaller.__main__.run(
(
"src\\app.py",
"--onefile",
"--icon",
"logo.ico",
"--uac-admin",
"--name",
"Guardian",
"--version-file",
"version.txt",
)
)
265 changes: 109 additions & 156 deletions poetry.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ license = "LGPL-3.0"
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.10"
python = "^3.10.0"
colorama = "^0.4.6"
cx-freeze = "^6.14.1"
pyinstaller = "^5.7.0"
pydivert = "2.1.0"
questionary = "^1.10.0"
tqdm = "^4.64.1"
Expand Down Expand Up @@ -37,7 +37,7 @@ profile = "black"

[tool.mypy]
platform = "win32"
exclude = ["build/", "speed_tests/", "tests"]
exclude = ["build/", "dist/", "speed_tests/", "tests", "build.py"]

[[tool.mypy.overrides]]
module = ["cx_Freeze", "pydivert", "prsw"]
Expand Down
75 changes: 0 additions & 75 deletions setup.py

This file was deleted.

32 changes: 18 additions & 14 deletions src/network/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,6 @@

logger = logging.getLogger("guardian")

debug_logger = logging.getLogger("debugger")
debug_logger.setLevel(logging.DEBUG)
if not debug_logger.handlers:
fh = logging.FileHandler("debugger.log")
fh.setLevel(logging.DEBUG)
fh.setFormatter(
logging.Formatter(
"[%(asctime)s][%(levelname)s] %(message)s", datefmt="%Y-%m-%d %H:%M:%S"
)
)
debug_logger.addHandler(fh)

# It appears that there is *ONE* more problem we may need to take care of which was missed during testing of the prototype.
# Apparently, it's not only R* tunnels, but also client tunnels! If the circumstances are right, then it turns out that
# people in your session can also tunnel players if they could not connect to you directly. Such is the joy of P2P
Expand Down Expand Up @@ -275,6 +263,22 @@ def __init__(self, ips: set[str], priority: int):
self.priority = priority
self.process = multiprocessing.Process(target=self.run)
self.process.daemon = True
self.init_debugging_log()

def init_debugging_log(self) -> None:
debug_logger = logging.getLogger("debugger")
debug_logger.setLevel(logging.DEBUG)
if not debug_logger.handlers:
fh = logging.FileHandler("debugger.log")
fh.setLevel(logging.DEBUG)
fh.setFormatter(
logging.Formatter(
"[%(asctime)s][%(levelname)s] %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
)
)
debug_logger.addHandler(fh)
self.logger = debug_logger

def start(self) -> None:
self.process.start()
Expand All @@ -283,7 +287,7 @@ def stop(self) -> None:
self.process.terminate()

def run(self) -> None:
debug_logger.debug("Started debugging")
self.logger.debug("Started debugging")
with pydivert.WinDivert(
PACKET_FILTER, priority=self.priority, flags=pydivert.Flag.SNIFF
) as w:
Expand Down Expand Up @@ -320,7 +324,7 @@ def run(self) -> None:
log = f"[{filler}] {src}:{packet.src_port} --> {dst}:{packet.dst_port}"
else:
log = f"[{filler}] {src}:{packet.src_port} <-- {dst}:{packet.dst_port}"
debug_logger.debug(log)
self.logger.debug(log)


# Okay, so there's a couple of changes that need to be done to fix auto-whitelisting.
Expand Down
41 changes: 41 additions & 0 deletions version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
VSVersionInfo(
ffi=FixedFileInfo(
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
# Set not needed items to zero 0.
filevers=(3, 3, 1, 0),
prodvers=(3, 3, 1, 0),
# Contains a bitmask that specifies the valid bits 'flags'r
mask=0x3f,
# Contains a bitmask that specifies the Boolean attributes of the file.
flags=0x1,
# The operating system for which this file was designed.
# 0x4 - NT and there is no need to change it.
OS=0x40004,
# The general type of file.
# 0x1 - the file is an application.
fileType=0x1,
# The function of the file.
# 0x0 - the function is not defined for this fileType
subtype=0x0,
# Creation date and time stamp.
date=(0, 0)
),
kids=[
StringFileInfo(
[
StringTable(
'040904E4',
[StringStruct('Comments', ''),
StringStruct('CompanyName', ''),
StringStruct('FileDescription', 'Firewall'),
StringStruct('FileVersion', '3.3.1'),
StringStruct('InternalName', 'Guardian.exe'),
StringStruct('LegalCopyright', ''),
StringStruct('LegalTrademarks', ''),
StringStruct('OriginalFilename', 'Guardian.exe'),
StringStruct('ProductName', 'Guardian'),
StringStruct('ProductVersion', '3.3.1')])
]),
VarFileInfo([VarStruct('Translation', [1033, 1252])])
]
)