Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automation #359

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions adv-mouse mover/code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import win32api
import win32con
import time
import random
import threading
import logging

# Set up logging
logging.basicConfig(filename='click_log.txt', level=logging.INFO, format='%(asctime)s - %(message)s')

def click(x, y):
win32api.SetCursorPos((x, y))
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y, 0, 0)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0)
logging.info(f'Clicked at: ({x}, {y})')

def clicker(click_count, x_min, x_max, y_min, y_max, interval):
for _ in range(click_count):
x = random.randint(x_min, x_max)
y = random.randint(y_min, y_max)
click(x, y)
time.sleep(interval)

def main():
# User-defined settings
click_count = 10 # Number of clicks
x_min, x_max = 0, 1920 # Screen width range (example for 1920x1080)
y_min, y_max = 0, 1080 # Screen height range (example for 1920x1080)
interval = 2 # Time in seconds between clicks

print("Clicking will start...")
click_thread = threading.Thread(target=clicker, args=(click_count, x_min, x_max, y_min, y_max, interval))
click_thread.start()

try:
while click_thread.is_alive():
time.sleep(1) # Keep the main thread alive while clicks are happening
except KeyboardInterrupt:
print("Clicking stopped by user.")
# Optionally, you could set a flag here to stop the clicker thread gracefully.

if __name__ == "__main__":
main()
5 changes: 5 additions & 0 deletions adv-mouse mover/info.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Key Features in the Enhanced Code:
Logging: Each click is logged to a file named click_log.txt, which records the coordinates of each click along with the timestamp.
Configurable Parameters: The number of clicks, clicking area, and interval between clicks can be easily configured at the beginning of the main() function.
Threading: The clicking process runs in a separate thread, allowing the main thread to remain responsive. This also makes it easier to implement a graceful exit.
Keyboard Interrupt Handling: You can stop the clicking process by pressing Ctrl+C in the terminal.
55 changes: 55 additions & 0 deletions ip-Ge0/code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import requests
import csv
import sys

URL = "http://ip-api.com/json/"

def locate_ip(ip):
try:
response = requests.get(URL + ip, headers={"User -Agent": "GeoLocator/1.0"})
response.raise_for_status() # Raise an error for bad responses
data = response.json()

if data["status"] == "success":
return {
"IP": ip,
"Country": data["country"],
"Region": data["regionName"],
"City": data["city"],
"ZIP": data["zip"],
"Latitude": data["lat"],
"Longitude": data["lon"],
"Timezone": data["timezone"],
"ISP": data["isp"],
}
else:
return {"IP": ip, "Error": "Unable to locate IP address."}

except requests.RequestException as e:
return {"IP": ip, "Error": str(e)}

def save_to_csv(results, filename='ip_geolocation_results.csv'):
keys = results[0].keys()
with open(filename, 'w', newline='') as output_file:
dict_writer = csv.DictWriter(output_file, fieldnames=keys)
dict_writer.writeheader()
dict_writer.writerows(results)

def main(ip_addresses):
results = []
for ip in ip_addresses:
result = locate_ip(ip)
results.append(result)
print(result)

# Save results to CSV
save_to_csv(results)

if __name__ == "__main__":
if len(sys.argv) > 1:
ip_addresses = sys.argv[1:] # Get IP addresses from command-line arguments
else:
ip_input = input("Enter IP Addresses to Geolocate (comma-separated): ")
ip_addresses = [ip.strip() for ip in ip_input.split(",")]

main(ip_addresses)