-
Notifications
You must be signed in to change notification settings - Fork 1
/
client.py
46 lines (32 loc) · 1.61 KB
/
client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import requests
from util import *
def send_text_scan(text:str,ip_addr:str) -> bool:
"""
sends the specified text
to the instance of copypasta running on the specified address
"""
r = requests.post(f"http://{ip_addr}:21987/upload",json={"type" : "text", "content" : f"{text}"})
return r.status_code == 200
def send_file(file_path:str,ip_addr:str):
"""
sends the specified file
to the instance of copypasta running on the specified address
"""
files = {'files': open(file_path,'rb')}
r = requests.post(f"http://{ip_addr}:21987/upload",files=files)
return r.status_code == 200
def send_keystrokes(text:str):
r = requests.post("http://127.0.0.1:21987/upload",json={"type" : "keystrokes", "content" : {"text" : f"{text}"}})
return r.status_code == 200
def send_barcode(text:str):
r = requests.post("http://127.0.0.1:21987/upload",json={"type" : "isbn", "content" : f"{text}"})
return r.status_code == 200
def send_wifi(ssid:str, encryption:str, key:str):
r = requests.post("http://127.0.0.1:21987/upload",json={"type" : "wifi", "content" : {"ssid" : f"{ssid}", "encryption" : f"{encryption}", "key" : f"{key}"}})
return r.status_code == 200
def send_email(dest_addr:str,subject:str,content:str):
r = requests.post("http://127.0.0.1:21987/upload",json={"type" : "email", "content" : {"address" : f"{dest_addr}", "subject" : f"{subject}", "content" : f"{content}"}})
return r.status_code == 200
def send_url(url:str):
r = requests.post("http://127.0.0.1:21987/upload",json={"type" : "url", "content" : f"{url}"})
return r.status_code == 200