kawiyennn
Diamond Üye
- Katılım
- 29 Tem 2021
- Mesajlar
- 255
- Beğeniler
- 31
Yardımları için @ExposerMonke31'e Teşekkürler.
Source kodları py convert etmedim hepsini tek tek convert etmeye üşendim zaten paste dosyada verdiğim importları yükleyin example aşşağıda ;
uncompyle6 decompile etmek istediğiniz pyc bu sekilde py olarak alırsınız.
Uğraşmak istemiyorsanız (önerimdir) aşşağıya arduino aimbot için gerekli kodları bıraktım
Kod:
#include <Mouse.h>
#include <Wire.h>
#include <SPI.h>
#include <usbhub.h>
USB Usb;
USBHub Hub(&Usb);
#include <hidboot.h>
HIDBoot<USB_HID_PROTOCOL_MOUSE> HidMouse(&Usb);
String myString;
int j = 0;
int c = 0;
int e = 0;
int lmb = 0;
int rmb = 0;
int mmb = 0;
int scroll = 0;
int dx;
int dy;
int arr[2];
int arrv[8];
// ----- Mouse Report Parser
class MouseRptParser : public MouseReportParser{
protected:
//void OnWheelMove (MOUSEINFO *mi);
void OnMouseMove (MOUSEINFO *mi);
void OnLeftButtonUp (MOUSEINFO *mi);
void OnLeftButtonDown (MOUSEINFO *mi);
void OnRightButtonUp (MOUSEINFO *mi);
void OnRightButtonDown (MOUSEINFO *mi);
void OnMiddleButtonUp (MOUSEINFO *mi);
void OnMiddleButtonDown (MOUSEINFO *mi);
};
void MouseRptParser::OnMouseMove(MOUSEINFO *mi){
dx = mi->dX;
dy = mi->dY;};
void MouseRptParser::OnLeftButtonUp (MOUSEINFO *mi){
lmb = 0;};
void MouseRptParser::OnLeftButtonDown (MOUSEINFO *mi){
lmb = 1;};
void MouseRptParser::OnRightButtonUp (MOUSEINFO *mi){
rmb = 0;};
void MouseRptParser::OnRightButtonDown (MOUSEINFO *mi){
rmb = 1;};
void MouseRptParser::OnMiddleButtonUp (MOUSEINFO *mi){
mmb = 0;};
void MouseRptParser::OnMiddleButtonDown (MOUSEINFO *mi){
mmb = 1;};
/*void MouseRptParser::OnWheelMove(MOUSEINFO *mi) {
scroll = mi->dZ;};*/
MouseRptParser Prs;
void setup() {
delay(5000);
Mouse.begin();
Serial.begin(115200);
Serial.setTimeout(1);
Usb.Init();
HidMouse.SetReportParser(0, &Prs);
}
void loop() {
dx = 0;
dy = 0;
j = 0;
c = 0;
e = 0;
Usb.Task();
//Clicking
if (lmb == 0){
Mouse.release(MOUSE_LEFT);}
else if (lmb == 1){
Mouse.press(MOUSE_LEFT);}
if (rmb == 0){
Mouse.release(MOUSE_RIGHT);}
else if (rmb == 1){
Mouse.press(MOUSE_RIGHT);}
if (mmb == 0){
Mouse.release(MOUSE_MIDDLE);}
else if (mmb == 1){
Mouse.press(MOUSE_MIDDLE);}
//Moving the mouse with pcinput
if (Serial.available()){
myString = Serial.readString();
for (int k = 0; k <= 1; k++){
String val = getValue(myString, ':', k);
arr[k] = val.toInt();
}
arr[0] += dx;
arr[1] += dy;
for (e = 0; e < (sizeof(arr) / sizeof(arr[0])); e++) {
if (arr[e] > 0){
for (j = 0; j <= (arr[e] / 127); j++){
c = j * 127;
if (int(arr[e]) > (c + 127)){
arrv[j] = 127;
}
else {
arrv[j] = arr[e] - c;
}
}
}
else {
for (j = 0; j <= (arr[e] / -127); j++){
c = j * -127;
if (arr[e] < (c - 127)){
arrv[j] = -127;
}
else {
arrv[j] = arr[e] - c;
}
}
}
for (int p = 0; p < j; p++){
if (e == 0){
//Serial.println("X: " + String(m));
Mouse.move(arrv[p], 0);
}
else if (e == 1){
//Serial.println("Y: " + String(m));
Mouse.move(0, arrv[p]);
}
}
memset(arrv, 0, sizeof(arrv));
}
}
//Moving the mouse without pcinput
else {
Mouse.move(dx, dy);
}
}
String getValue(String data, char separator, int index)
{
int found = 0;
int strIndex[] = { 0, -1 };
int maxIndex = data.length() - 1;
for (int i = 0; i <= maxIndex && found <= index; i++) {
if (data.charAt(i) == separator || i == maxIndex) {
found++;
strIndex[0] = strIndex[1] + 1;
strIndex[1] = (i == maxIndex) ? i+1 : i;
}
}
ret
Python
Kod:
import time
import cv2
import mss.tools
import numpy as np
import math
import keyboard
import serial
import win32api
import win32con
import win32gui
import win32ui
CONFIDENCE_THRESHOLD = 0.5
NMS_THRESHOLD = 0.5
COLORS = [(0, 255, 255), (255, 255, 0), (0, 255, 0), (255, 0, 0)]
AIMING_POINT = 1 # 0 for "head", 1 for chest, 2 for legs
ACTIVATION_RANGE = 400
arduino = serial.Serial('COM17', 115200, timeout=0)
def grab_screen(region=None):
hwin = win32gui.GetDesktopWindow()
if region:
left, top, x2, y2 = region
widthScr = x2 - left + 1
heightScr = y2 - top + 1
else:
widthScr = win32api.GetSystemMetrics(win32con.SM_CXVIRTUALSCREEN)
heightScr = win32api.GetSystemMetrics(win32con.SM_CYVIRTUALSCREEN)
left = win32api.GetSystemMetrics(win32con.SM_XVIRTUALSCREEN)
top = win32api.GetSystemMetrics(win32con.SM_YVIRTUALSCREEN)
hwindc = win32gui.GetWindowDC(hwin)
srcdc = win32ui.CreateDCFromHandle(hwindc)
memdc = srcdc.CreateCompatibleDC()
bmp = win32ui.CreateBitmap()
bmp.CreateCompatibleBitmap(srcdc, widthScr, heightScr)
memdc.SelectObject(bmp)
memdc.BitBlt((0, 0), (widthScr, heightScr), srcdc, (left, top), win32con.SRCCOPY)
signedIntsArray = bmp.GetBitmapBits(True)
img = np.frombuffer(signedIntsArray, dtype='uint8')
img.shape = (heightScr, widthScr, 4)
srcdc.DeleteDC()
memdc.DeleteDC()
win32gui.ReleaseDC(hwin, hwindc)
win32gui.DeleteObject(bmp.GetHandle())
return cv2.cvtColor(img, cv2.COLOR_BGRA2BGR)
with mss.mss() as sct:
Wd, Hd = sct.monitors[1]["width"], sct.monitors[1]["height"]
monitor = (int(Wd / 2 - ACTIVATION_RANGE / 2),
int(Hd / 2 - ACTIVATION_RANGE / 2),
int(Wd / 2 + ACTIVATION_RANGE / 2),
int(Hd / 2 + ACTIVATION_RANGE / 2))
with open("E:/AIstuff/yolov4/coco-dataset.labels", "r") as f:
class_names = [cname.strip() for cname in f.readlines()]
net = cv2.dnn.readNet("E:/AIstuff/yolov4/yolov4-tiny.weights", "E:/AIstuff/yolov4/yolov4-tiny.cfg")
net.setPreferableBackend(cv2.dnn.DNN_BACKEND_CUDA)
net.setPreferableTarget(cv2.dnn.DNN_TARGET_CUDA)
model = cv2.dnn_DetectionModel(net)
model.setInputParams(size=(416, 416), scale=1 / 255, swapRB=True)
while True:
#start = time.time()
frame = np.array(grab_screen(region=monitor))
classes, scores, boxes = model.detect(frame, CONFIDENCE_THRESHOLD, NMS_THRESHOLD)
#for (classID, score, box) in zip(classes, scores, boxes):
#color = COLORS[int(classID) % len(COLORS)]
#label = "%s : %f" % (class_names[classID[0]], score)
#cv2.rectangle(frame, box, color, 2)
#cv2.putText(frame, label, (box[0], box[1] - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, color, 2)
enemyNum = len(boxes)
if enemyNum == 0:
pass
else:
# Reset distances array to prevent duplicating items
distances = []
closest = 1000
closestObject = None
# Cycle through results (enemies) and get the closest to the center of detection box
for i in range(enemyNum):
X = float(boxes[i][0])
Y = float(boxes[i][1])
width = float(boxes[i][2])
height = float(boxes[i][3])
centerX = X + (width / 2)
centerY = Y + (height / 2)
distance = math.sqrt(((centerX - ACTIVATION_RANGE / 2) ** 2) + ((centerY - ACTIVATION_RANGE / 2) ** 2))
distances.append(distance)
if distances[i] < closest:
closest = distances[i]
closestObject = i
X = float(boxes[closestObject][0])
Y = float(boxes[closestObject][1])
width = float(boxes[closestObject][2])
height = float(boxes[closestObject][3])
if AIMING_POINT == 0:
height = (height / 8) * 1
elif AIMING_POINT == 1:
height = (height / 8) * 2
elif AIMING_POINT == 2:
height = (height / 8) * 5
cClosestX = X + (width / 2)
cClosestY = Y + height
#cv2.line(frame, (int(cClosestX), int(cClosestY)), (int(ACTIVATION_RANGE / 2), int(ACTIVATION_RANGE / 2)),
#(255, 0, 0), 1, cv2.LINE_AA)
difX = int(cClosestX - (ACTIVATION_RANGE / 2))
difY = int(cClosestY - (ACTIVATION_RANGE / 2))
if abs(difX) < 2 and abs(difY) < 2:
pass
else:
if keyboard.is_pressed('v'):
data = str(difX) + ':' + str(difY)
arduino.write(data.encode())
#end = time.time()
#fps_label = "FPS: %.2f" % (1 / (end - start))
#cv2.putText(frame, fps_label, (0, 25), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)
# cv2.imshow("", frame)
if cv2.waitKey(1) & 0xFF == ord("q"):
cv2.destroyAllWindows()
sct.close()
break
Kod:
difX = int(cClosestX - (ACTIVATION_RANGE / 2)) *
difY = int(cClosestY - (ACTIVATION_RANGE / 2)) *
Linkleri görebilmek için kayıt olmanız gerekmektedir