-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfrida-scripts-fetcher-exploiter.py
147 lines (129 loc) · 7 KB
/
frida-scripts-fetcher-exploiter.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
146
147
import argparse
import subprocess
import requests
import re
from concurrent.futures import ThreadPoolExecutor
from bs4 import BeautifulSoup
from urllib.parse import urlparse
banner="""
_______ _______ _______ _______ _______________________________________
( ____ \ ( ____ \ ( ____ ( ____ ( ____ )__ __( ____ )__ __( ____ \\
| ( \/ | ( \/ | ( \/ ( \/ ( )| ) ( | ( )| ) ( | ( \/
| (_____ | (__ | (_____| | | (____)| | | | (____)| | | | (_____
(_____ ) | __) (_____ ) | | __) | | | _____) | | (_____ )
) | | ( ) | | | (\ ( | | | ( | | ) |
/\____) | | ) /\____) | (____/\ ) \ \____) (__| ) | | /\____) |
\_______) |/______ \_______|_______// \__|_______// )_( \_______)
( ____ \ ( ____ )
| ( \/ | ( )|
| (__ | (____)|
| __) | __)
| ( | (\ (
| (____/\ | ) \ \__
(_______/ |/___\__/ _______ _______ _ ________________________
( ___ ) \__ __/ ( ____ \\ /( ____ | \ ( ___ )__ __|__ __/
| ( ) | ) ( | ( \( \ / ) ( )| ( | ( ) | ) ( ) (
| (___) | | | | (__ \ (_) /| (____)| | | | | | | | | |
| ___ | | | | __) ) _ ( | _____) | | | | | | | | |
| ( ) | | | | ( / ( ) \| ( | | | | | | | | | |
| ) ( | ___) (___ | (____/( / \ ) ) | (____/\ (___) |__) (___ | |
|/_____\| \_______/ (_______// \|/ (_______(_______)_______/ )_(
( ____ ) ( __ \
| ( )| | ( \ )
| (____)| | | ) |
| __) | | | |
| (\ ( | | ) |
| ) \ \__ | (__/ )
|/___\__/ (______/
( ____ \ ( ___ )
| ( \/ | ( ) |
| | | (___) |
| | | ___ |
| | | ( ) |
| (____/\ | ) ( |
(\_____// |/ \|
| ) ( |
| (___) |
| ___ |
| ( ) |
| ) ( |
|/ \|
================ Made By Kamaldeep Bhati (@DarkLotusKDB) <3 ===================
"""
print(banner)
def fetch_scripts(page):
url = f"https://codeshare.frida.re/browse?page={page}"
response = requests.get(url)
html = response.text
h2_tags = re.findall(r'<h2>(.*?)</h2>', html, flags=re.IGNORECASE)
return h2_tags
def fetch_response(url):
try:
response = requests.get(url)
return response.text
except:
return None
def execute_frida_command(url, binary_input):
modified_url = re.sub(r'^https://codeshare.frida.re/@', 'frida -U --codeshare ', url)
modified_url = re.sub(r'/$', f' -f {binary_input}', modified_url)
print(modified_url)
while True:
response = input("\n[/] Do you want to execute this command? (Y/N): ")
if response.lower() == 'y':
try:
subprocess.run(modified_url, shell=True)
frida_ps_output = subprocess.check_output(['frida-ps', '-Ua'], universal_newlines=True)
pids = re.findall(rf'\s(\d+)\s.*{re.escape(binary_input)}', frida_ps_output)
for pid in pids:
print(pid)
print("\n")
subprocess.run(['frida-kill', '-U', pid])
break
except subprocess.CalledProcessError:
print("Error: Unable to run 'frida-ps -Ua' command.")
break
elif response.lower() == 'n':
print("[-] Skipping this command.\n\n")
break
else:
print("Invalid input. Please enter Y or N.\n")
def search_scripts(keyword, end_page):
try:
urls = []
print(f"[+] Extracting all the scripts with the word '{keyword}' in their names.")
print()
with ThreadPoolExecutor(max_workers=5) as executor:
futures = []
for i in range(1, end_page + 1):
futures.append(executor.submit(fetch_scripts, i))
for future in futures:
h2_tags = future.result()
keyword_scripts = [h2 for h2 in h2_tags if re.search(keyword, h2, flags=re.IGNORECASE)]
for script in keyword_scripts:
print(script)
match = re.search(r'href="(.*?)"', script)
if match:
urls.append(match.group(1))
print("\n[+] Executing 'frida-ps -Ua' command:")
frida_ps_output = subprocess.check_output(['frida-ps', '-Ua'], universal_newlines=True)
print(frida_ps_output)
binary_input = input("\n[+] Enter the target (Identifier): ")
print("\n[+] Executing Frida scripts based on the above serach results:\n")
for url in urls:
execute_frida_command(url, binary_input)
except KeyboardInterrupt:
print("\n[-] Terminated by user.")
exit(0)
def main():
parser = argparse.ArgumentParser(description='Frida Scripts Fetcher')
parser.add_argument('-s', '--search', metavar='string', type=str, help='Search keyword')
parser.add_argument('-p', '--pages', metavar='number', type=int, default=20, help='Number of pages to search (Default 20)')
args = parser.parse_args()
if args.search:
search_scripts(args.search, args.pages)
else:
parser.print_help()
print("\nFollow Me On Twitter @DarkLotusKDB")
print("Happy Hacking")
if __name__ == '__main__':
main()