-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --protectinterface argument. #939
base: master
Are you sure you want to change the base?
Conversation
8542681
to
12a19ef
Compare
@blackHatMonkey @anakin1028 Can you review & merge? |
wifiphisher/common/interfaces.py
Outdated
if not is_managed_by_network_manager(interface): | ||
raise InterfaceManagedByNetworkManagerError(interface) | ||
|
||
return True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why return True
here? as far as I can see this method is just to raise an error.
wifiphisher/pywifiphisher.py
Outdated
@@ -401,7 +407,11 @@ def start(self): | |||
time.sleep(1) | |||
self.stop() | |||
|
|||
if not args.internetinterface: | |||
if args.protectinterface: | |||
for i in args.protectinterface: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also change i
to a more descriptive name such as interface
?
wifiphisher/common/interfaces.py
Outdated
:rtype bool | ||
""" | ||
|
||
out = check_output(["nmcli", "dev", interface, "managed", "no"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check_output
needs to be in a try
except
in case non-zero return value. Also stderr
needs to be handled as well.
12a19ef
to
09ad3b7
Compare
Updated. |
09ad3b7
to
3196c03
Compare
Can you guys merge this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit confused. Based on this code if I give it a interface it will call the nm_unmanage
which will disconnect it from the internet. Isn't this the exact opposite of what we want.
""" | ||
|
||
try: | ||
out = check_output(["nmcli", "dev", interface, "managed", "no"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should Popen
here and catch stderr
. We can log that so the user knows that command failed.
try: | ||
out = check_output(["nmcli", "dev", interface, "managed", "no"]) | ||
# (CalledProcessError) | ||
except: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should not use a bare except
as it hides errors.
for iface in args.protectinterface: | ||
self.network_manager.nm_unmanage(iface) | ||
|
||
if not args.internetinterface and not args.protectinterface: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this and
should change to a or
.
"-pI", | ||
"--protectinterface", | ||
nargs='+', | ||
help=("Choose an interface that you want to protect and persist its connection. " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wording needs to be changed a bit to show you can have more than one interface.
@@ -401,7 +407,11 @@ def start(self): | |||
time.sleep(1) | |||
self.stop() | |||
|
|||
if not args.internetinterface: | |||
if args.protectinterface: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if condition is unnecessary.
is there any news about the merge? When will we be able to use the --protect-interface option? |
@sophron Are we still continuing with this PR. If so I can help fix those errors. |
Oh I've left that behind. Can you continue it @blackHatMonkey? |
sorry guys, any possibility to see that fixed? |
Hi @Tsadoq, Yes, I'll make this a priority. |
An update on this. You can currently keep network manager alive using the I'll work on automating the process the next days. |
No description provided.