Remote-Code-Command-execution

A naive ssh clone, with screen sharing
git clone https://github.com/abdulrahim2002/Remote-Code-Command-execution

Log | Files | Refs | README

utility.py (845B)


      1 import psutil
      2 from urllib.parse import urlparse
      3 import os
      4 
      5 def getpath():
      6     '''get path of current directory'''
      7     return os.path.dirname(os.path.abspath(__file__))
      8 
      9 def printUI():
     10     print('\nThis is telnet implementation.\n'
     11           'You can execute commands remotely.\n')
     12     print("\n")
     13     
     14 # get a list of all commands available on the system
     15 def getCommands():
     16     '''get a list of all commands available on the system'''
     17     return os.popen("help").read().split("\n")
     18     
     19 '''server functions'''
     20 # returns ip address assigned by router
     21 def get_ip_address():
     22     addrs = psutil.net_if_addrs()
     23     if "Wi-Fi" in addrs:
     24         wifi_info = addrs["Wi-Fi"]
     25         for info in wifi_info:
     26             if info.family == 2: # 2 is the address family for IPv4
     27                 return info.address
     28     return None