Skip to content

Commit

Permalink
Fixed Configure argument parsing for router auth
Browse files Browse the repository at this point in the history
  • Loading branch information
RafayGhafoor committed Aug 15, 2017
1 parent 6659e6c commit 339361d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions ptcl.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ 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.')
parser.add_argument('-c', '--configure', help='Configure router settings.', action='store_true')
parser.add_argument('-q', '--quiet', help='Quite mode.', nargs='?', default='True')
args = parser.parse_args()
# print args
Expand Down Expand Up @@ -71,14 +71,18 @@ def main():

elif args.configure:
# Creating a config file
DEFAULT = {'mask': '192.168.1.1', 'username': 'admin', 'password': 'admin'}
mask = raw_input("Please enter router gateway: \t\t# Default 192.168.1.1")
if mask:
DEFAULT['mask'] = mask
username = raw_input("Please enter username of your router page: \t\t# Default 'admin'")
if username:
DEFAULT['username'] = username
password = raw_input("Please enter password of your router page: \t\t# Default 'admin'")
config['Router-Auth'] = {
'mask': '192.168.1.1',
'username': 'admin',
'password': 'admin'
}
if password:
DEFAULT['password'] = password
config['Router-Auth'] = DEFAULT

with open('config.ini', 'w') as configfile:
config.write(configfile)

Expand Down

0 comments on commit 339361d

Please sign in to comment.