Skip to content

Commit

Permalink
Fixed args
Browse files Browse the repository at this point in the history
  • Loading branch information
RafayGhafoor committed Aug 30, 2017
1 parent dfc1d32 commit 014431d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
12 changes: 6 additions & 6 deletions ptcl.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import configobj


ptcl = Router()
# ptcl = Router(mask='192.168.10.1', password='bec10')
# ptcl = Router()
ptcl = Router(mask='192.168.10.1', password='')
# Defining custom aliases
# config['User-Aliases'] = {
# "mytab": "5c:2e:59:4d:33:67",
Expand All @@ -23,13 +23,13 @@ def main():
parser.add_argument('-r', '--restart', help="Restart Router.", action='store_true')
parser.add_argument('-sd', '--show-dhcp', help='Show DHCP Info.', action='store_true')
parser.add_argument('-s', '--show-active', help='Show Active Devices.', default='.')
parser.add_argument('-c', '--configure', help='Configure router settings.', action='store_true')
parser.add_argument('--configure', help='Configure router settings.', action='store_true')
parser.add_argument('-sa', '--set-alias', help='Set custom alias for a device hostname.', action='store_true')
parser.add_argument('-q', '--quiet', help='Quite mode.', nargs='?', default='True')
parser.add_argument('-c', '--cli', help='Silent mode.', nargs='?', default='False')
args = parser.parse_args()
# print args

if args.quiet == 'True':
if args.cli == 'False':
if args.block:
# print "Calling blocker Function"
ptcl.get_sessionkey()
Expand Down Expand Up @@ -99,7 +99,7 @@ def main():
print "Invalid Argument"


elif not args.quiet:
elif not args.cli:
if not args.block:
# print "Calling blocker function - CLI MODE."
name = ptcl.show_active_dev()
Expand Down
21 changes: 14 additions & 7 deletions router.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ def get_sessionkey(self):


def get_dhcpinfo(self):
'''Gets information from dhcp i.e., Mac Adresses and Hostnames.'''
'''
Gets information from dhcp i.e., Mac Adresses and Hostnames.
'''
r, soup = self.scrape_page(self.mask + 'dhcpinfo.html')
count = 1
td = soup.findAll('td')
Expand All @@ -76,7 +78,9 @@ def get_dhcpinfo(self):


def show_dhcpinfo(self):
'''Shows DHCP information.'''
'''
Shows DHCP information.
'''
self.get_dhcpinfo()
print "-" * 20 + "DHCP-INFO" + "-" * 20 + '\n'
for num, i in enumerate(zip(self.dev_hostname, self.mac_address), 1):
Expand All @@ -95,7 +99,6 @@ def get_stationinfo(self):
if self.mac_adr_regex.search(i.text.strip()):
self.active_dev.append(i.text.strip().lower().encode('ascii'))


def show_active_dev(self):
'''
Shows active devices (Mac Addresses) and their hostnames.
Expand Down Expand Up @@ -207,12 +210,16 @@ def get_suspects(self):


def monitor_dev(self): # Monitor Devices
'''Monitor devices, when they connect to router and disconnect. Also
gets the time a device remains connected to the router.'''
'''
Monitor devices, when they connect to router and disconnect. Also
gets the time a device remains connected to the router.
'''
pass


def dev_conninfo(self): # Device Connection Info
'''Analyzes how much time a device remains connected to the device throughout
the day.'''
'''
Analyzes how much time a device remains connected to the device throughout
the day.
'''
pass

0 comments on commit 014431d

Please sign in to comment.