Spaces:
Runtime error
Runtime error
ZackBradshaw
commited on
Upload folder using huggingface_hub
Browse files- __pycache__/logger.cpython-310.pyc +0 -0
- main.py +104 -104
__pycache__/logger.cpython-310.pyc
CHANGED
Binary files a/__pycache__/logger.cpython-310.pyc and b/__pycache__/logger.cpython-310.pyc differ
|
|
main.py
CHANGED
@@ -23,7 +23,7 @@ from bs4 import BeautifulSoup
|
|
23 |
|
24 |
# from logger import logger
|
25 |
|
26 |
-
from
|
27 |
class ToolScope(Enum):
|
28 |
GLOBAL = "global"
|
29 |
SESSION = "session"
|
@@ -250,110 +250,110 @@ class ToolsFactory:
|
|
250 |
|
251 |
|
252 |
|
253 |
-
##########################################+> SYS
|
254 |
-
import signal
|
255 |
-
from typing import Optional, Tuple
|
256 |
|
257 |
-
from ptrace.debugger import (
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
)
|
265 |
-
from ptrace.func_call import FunctionCallOptions
|
266 |
-
from ptrace.syscall import PtraceSyscall
|
267 |
-
from ptrace.tools import signal_to_exitcode
|
268 |
-
|
269 |
-
|
270 |
-
class SyscallTimeoutException(Exception):
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
class SyscallTracer:
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
def reset_timer(self):
|
301 |
-
|
302 |
-
|
303 |
-
def wait_syscall_with_timeout(self, timeout: int):
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
def wait_until_stop_or_exit(self) -> Tuple[Optional[int], str]:
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
##########################################+> SYS CALL END
|
358 |
|
359 |
|
|
|
23 |
|
24 |
# from logger import logger
|
25 |
|
26 |
+
from logger import logger
|
27 |
class ToolScope(Enum):
|
28 |
GLOBAL = "global"
|
29 |
SESSION = "session"
|
|
|
250 |
|
251 |
|
252 |
|
253 |
+
# ##########################################+> SYS
|
254 |
+
# import signal
|
255 |
+
# from typing import Optional, Tuple
|
256 |
|
257 |
+
# from ptrace.debugger import (
|
258 |
+
# NewProcessEvent,
|
259 |
+
# ProcessExecution,
|
260 |
+
# ProcessExit,
|
261 |
+
# ProcessSignal,
|
262 |
+
# PtraceDebugger,
|
263 |
+
# PtraceProcess,
|
264 |
+
# )
|
265 |
+
# from ptrace.func_call import FunctionCallOptions
|
266 |
+
# from ptrace.syscall import PtraceSyscall
|
267 |
+
# from ptrace.tools import signal_to_exitcode
|
268 |
+
|
269 |
+
|
270 |
+
# class SyscallTimeoutException(Exception):
|
271 |
+
# def __init__(self, pid: int, *args) -> None:
|
272 |
+
# super().__init__(f"deadline exceeded while waiting syscall for {pid}", *args)
|
273 |
+
|
274 |
+
|
275 |
+
# class SyscallTracer:
|
276 |
+
# def __init__(self, pid: int):
|
277 |
+
# self.debugger: PtraceDebugger = PtraceDebugger()
|
278 |
+
# self.pid: int = pid
|
279 |
+
# self.process: PtraceProcess = None
|
280 |
+
|
281 |
+
# def is_waiting(self, syscall: PtraceSyscall) -> bool:
|
282 |
+
# if syscall.name.startswith("wait"):
|
283 |
+
# return True
|
284 |
+
# return False
|
285 |
+
|
286 |
+
# def attach(self):
|
287 |
+
# self.process = self.debugger.addProcess(self.pid, False)
|
288 |
+
|
289 |
+
# def detach(self):
|
290 |
+
# self.process.detach()
|
291 |
+
# self.debugger.quit()
|
292 |
+
|
293 |
+
# def set_timer(self, timeout: int):
|
294 |
+
# def handler(signum, frame):
|
295 |
+
# raise SyscallTimeoutException(self.process.pid)
|
296 |
+
|
297 |
+
# signal.signal(signal.SIGALRM, handler)
|
298 |
+
# signal.alarm(timeout)
|
299 |
+
|
300 |
+
# def reset_timer(self):
|
301 |
+
# signal.alarm(0)
|
302 |
+
|
303 |
+
# def wait_syscall_with_timeout(self, timeout: int):
|
304 |
+
# self.set_timer(timeout)
|
305 |
+
# self.process.waitSyscall()
|
306 |
+
# self.reset_timer()
|
307 |
+
|
308 |
+
# def wait_until_stop_or_exit(self) -> Tuple[Optional[int], str]:
|
309 |
+
# self.process.syscall()
|
310 |
+
# exitcode = None
|
311 |
+
# reason = ""
|
312 |
+
# while True:
|
313 |
+
# if not self.debugger:
|
314 |
+
# break
|
315 |
+
|
316 |
+
# try:
|
317 |
+
# self.wait_syscall_with_timeout(30)
|
318 |
+
# except ProcessExit as event:
|
319 |
+
# if event.exitcode is not None:
|
320 |
+
# exitcode = event.exitcode
|
321 |
+
# continue
|
322 |
+
# except ProcessSignal as event:
|
323 |
+
# event.process.syscall(event.signum)
|
324 |
+
# exitcode = signal_to_exitcode(event.signum)
|
325 |
+
# reason = event.reason
|
326 |
+
# continue
|
327 |
+
# except NewProcessEvent as event:
|
328 |
+
# continue
|
329 |
+
# except ProcessExecution as event:
|
330 |
+
# continue
|
331 |
+
# except Exception as e:
|
332 |
+
# reason = str(e)
|
333 |
+
# break
|
334 |
+
|
335 |
+
# syscall = self.process.syscall_state.event(
|
336 |
+
# FunctionCallOptions(
|
337 |
+
# write_types=False,
|
338 |
+
# write_argname=False,
|
339 |
+
# string_max_length=300,
|
340 |
+
# replace_socketcall=True,
|
341 |
+
# write_address=False,
|
342 |
+
# max_array_count=20,
|
343 |
+
# )
|
344 |
+
# )
|
345 |
+
|
346 |
+
# self.process.syscall()
|
347 |
+
|
348 |
+
# if syscall is None:
|
349 |
+
# continue
|
350 |
+
|
351 |
+
# if syscall.result:
|
352 |
+
# continue
|
353 |
+
|
354 |
+
# self.reset_timer()
|
355 |
+
|
356 |
+
# return exitcode, reason
|
357 |
##########################################+> SYS CALL END
|
358 |
|
359 |
|