Beispiel #1
0
def handle(msg):
    global light
    global REBOOT_CHECK, RESETPASS
    chat_id = msg['chat']['id']
    command = msg['text']

    print 'Got command: ' + command + ' from: ' + str(chat_id)

    if command == '/roll':
        bot.sendMessage(chat_id, random.randint(1, 6))
    elif command == '/time':
        bot.sendMessage(chat_id, str(datetime.datetime.now()))
    elif command == '/spitip':
        bot.sendMessage(chat_id, str(getip.get()))
    elif command == '/uptime':
        uptimemessage = 'The system uptime is: ' + uptime()
        bot.sendMessage(chat_id, uptimemessage)
    elif command == '/aziz':
        light = not (light)
        if light:
            bot.sendMessage(chat_id, 'Good boy Aziz')
        else:
            bot.sendMessage(chat_id, 'Aziz light!!!')
    elif command == '/bash':
        bot.sendMessage(chat_id, "Be patient I'm choosing a random quote!")
        #422 is the last site of all quotes in bash.org
        quote_tbs = bashquote(random.randint(1, 422), chat_id)
        bot.sendMessage(chat_id, "The quote is:")
        for quote_sentence in quote_tbs:
            bot.sendMessage(chat_id, quote_sentence)
    elif command == '/help' or command == '/?':
        bot.sendMessage(
            chat_id,
            '/help - Lists these commands below (/?) is also accepted\n' +
            '/torrentstatus - Gives you the status of the torrents\n' +
            '/bash - Grabs a quote from bash.org and send it you\n' +
            '/time - Report current time\n' +
            '/spitip - Blurt the current public IP\n' +
            '/uptime - Give the total uptime\n' +
            '/aziz - Play with Aziz and feel like exploring an alien cave\n' +
            '/roll - Roll 1d6')
    elif command == '/reboot':
        bot.sendMessage(chat_id, 'Enter the reboot password at any time')
        REBOOT_CHECK = True
    elif command == RESETPASS[0] and REBOOT_CHECK:
        bot.sendMessage(chat_id, 'Rebooting now')
        os.system('reboot')
    elif command == '/torrentstatus':
        bot.sendMessage(chat_id, "Hold on I'm checking Deluge...\n")
        command = shlex.split(
            'deluge-console "connect 127.0.0.1:58846 localclient ' +
            LOCALCLIENTPWD[0] + ' ; info ; exit"')
        process = subprocess.Popen(command, stdout=subprocess.PIPE)
        output, err = process.communicate()
        bot.sendMessage(chat_id, str(output))
        bot.sendMessage(chat_id, "These were all the Torrents")
    else:
        bot.sendMessage(chat_id, 'I did not understand you')
Beispiel #2
0
import socket, getip, time, struct

host = getip.get()
port = 65432

with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:
    s.bind((host, port))
    print("waiting on", host, "at", port)
    data, addr = s.recvfrom(1024)  # buffer size is 1024 bytes
    now = time.time()
    print("Time on Server: ", now)
    s.sendto(struct.pack('!d', now), addr)
Beispiel #3
0
os.system('cls')


def host_tcp(sock01):
    sock01 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)


def host_udp(sock02):
    sock02 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)


mac = os.system('GETMAC /V' "\n")
host_name = socket.gethostname()
host_local_ip = socket.gethostbyname(host_name)
host_public_ip = getip.get()
print("\n"
      "Host Name:", host_name, "\n"
      "Local IP:", host_local_ip, "\n"
      "Public IP:", host_public_ip, "\n")
remoteServer = input("Enter a remote host to scan: ")
remoteServerIP = socket.gethostbyname(remoteServer)

#-----PING_CODE-----

response = os.system("ping " + remoteServerIP)
if response == 0:
    print(remoteServer, 'is up!')
else:
    print(remoteServer, 'is down!')
Beispiel #4
0
 def get_connectable_host(self):
     if self.host == '0.0.0.0':
         return getip.get()
     else:
         return self.host
Beispiel #5
0
response = client.do_action_with_exception(request)
data = json.loads(response)  #str to json

#Find RecordId where RR equle to RR in init file
for i in data['DomainRecords']['Record']:
    if i['RR'] == info['RR']:
        RecordId = i['RecordId']

update_request = CommonRequest()
update_request.set_accept_format('json')
update_request.set_domain('alidns.aliyuncs.com')
update_request.set_method('POST')
update_request.set_version('2015-01-09')
update_request.set_action_name('UpdateDomainRecord')

import getip
my_ip = getip.get()

update_request.add_query_param('RecordId', RecordId)
update_request.add_query_param('RR', info['RR'])
update_request.add_query_param('Type', info['Type'])
update_request.add_query_param('Value', my_ip)

update_dns = json.loads(client.do_action(update_request))

if (update_dns['Code'] == 'DomainRecordDuplicate'):
    print 'Escape Already exist record'
else:
    print 'DomainRecord Update Successfully!'
Beispiel #6
0
import getip
import gspread
import time

from oauth2client.service_account import ServiceAccountCredentials

# Get the public IP address
ip = getip.get()

# Get the local time
localtime = time.asctime(time.localtime(time.time()))

# Log in to the spreadsheet
scope = ['https://spreadsheets.google.com/feeds']
credentials = ServiceAccountCredentials.from_json_keyfile_name(
    'credentials.json', scope)
gc = gspread.authorize(credentials)
wks = gc.open("Public IP").sheet1

# Update the spreadsheet
wks.update_acell('A2', ip)
wks.update_acell('B2', localtime)
Beispiel #7
0
import requests
import getip
import ast
import sys

url = "https://iplocation.com"

print("=== Welcome to ip_info ===")
url = "https://iplocation.com"
if len(sys.argv) != 1:
    request = requests.post(url,data={'ip':sys.argv[1]})
    info = ast.literal_eval(request.text)
    print("[+]ip : "+str(info['ip']))
    print("[+]Your city : "+str(info['city']))
    print("[+]Your region : "+str(info['region_name']))
    print("[+]Your country : "+str(info['country_name']))
    print("[+]Time zone : "+str(info['time_zone']))
    print("[+]Your latitude and longitude  : "+str(info['lat'])+","+str(info['lng']))
else:
    request = requests.post(url,data={'ip':getip.get()})
    info = ast.literal_eval(request.text)
    print("[+]Your ip : "+str(info['ip']))
    print("[+]Your city : "+str(info['city']))
    print("[+]Your region : "+str(info['region_name']))
    print("[+]Your country : "+str(info['country_name']))
    print("[+]Time zone : "+str(info['time_zone']))
    print("[+]Your latitude and longitude  : "+str(info['lat'])+","+str(info['lng']))
Beispiel #8
0
print(Fore.BLUE + Style.BRIGHT + "|  __/ _ \/ __/ _` | '_ \ " + Fore.YELLOW + " |  __/ | | |")
print(Fore.BLUE + Style.BRIGHT + "| | |  __/ (_| (_| | | | |" + Fore.YELLOW + " | |  | |_| |")
print(Fore.BLUE + Style.BRIGHT + "\_|  \___|\___\__,_|_| |_|" + Fore.YELLOW + " \_|   \__, |")
print(Fore.BLUE + Style.BRIGHT + "                          " + Fore.YELLOW + "        __/ |")
print(Fore.BLUE + Style.BRIGHT + "                          " + Fore.YELLOW + "       |___/ ")
print("")
print(Fore.GREEN + Style.BRIGHT + "|------ A Tool Made By Landfill ------|")
print(Fore.RED + Style.BRIGHT + "|--------------- Enjoy ---------------|")
print(Fore.BLUE + Style.BRIGHT + "|--- Give Credit For Any Code Used ---|")
print(Fore.MAGENTA + Style.BRIGHT + "Creator Is Not Responsible For Anything")
print("")
print(Fore.BLUE + Style.BRIGHT + "[1]" + Fore.YELLOW + " Get Your Info")
print(Fore.BLUE + Style.BRIGHT + "[2]" + Fore.YELLOW + " Geolocate An IP")
print("")
choice = input("Pecan>> ")

if choice == "1":
    Your_IP = socket.gethostbyname(socket.gethostname())
    Computer_Name = socket.gethostname()
    Ex_IP = getip.get()
    print("")
    print(Fore.RED + Style.BRIGHT + "Your IP Is...",Your_IP)
    print(Fore.GREEN + Style.BRIGHT + "On...",Computer_Name)
    print(Fore.BLUE + Style.BRIGHT + "Your External IP Is...",Ex_IP)

if choice == "2":
    enip = input("Enter IP: ")
    time.sleep(2)
    print(Fore.RED + Style.BRIGHT + "Geolocating...",enip)
    webbrowser.open("http://www.ip-api.com/#" + enip)