Skip to content
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

wlanip is an invalid command #9

Closed
UlyssesZh opened this issue Aug 4, 2022 · 6 comments · Fixed by #10
Closed

wlanip is an invalid command #9

UlyssesZh opened this issue Aug 4, 2022 · 6 comments · Fixed by #10
Assignees
Labels
bug Something isn't working

Comments

@UlyssesZh
Copy link

Termux-SSH >> wlanip
[!] INVALID COMMAND
@dmdhrumilmistry
Copy link
Owner

the command is wlan ip, you can use help command for more information.

@UlyssesZh
Copy link
Author

Then the command list in README should be fixed.

@UlyssesZh
Copy link
Author

The wlan ip command crashes Termux-SSH:

Termux-SSH >> wlan ip                                                                                                                                                                         
Warning: cannot open /proc/net/dev (Permission denied). Limited output.                                                                                                                       
[-] An Error occured while running the script, please create an issue on github to resolve issue and make script better.                                                                      
[*] Github URL: https://github.com/dmrdhrumilmistry/Termux-SSH                                                                                                                                
Traceback (most recent call last):                                                                                                                                                            
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/termux_ssh/__main__.py", line 57, in <module>
    wlan_ip = get_wlan_ip()
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/termux_ssh/termux.py", line 158, in get_wlan_ip
    wlan_info = subprocess.check_output("ifconfig wlan0", shell=True).decode('utf-8')
  File "/data/data/com.termux/files/usr/lib/python3.10/subprocess.py", line 420, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/data/data/com.termux/files/usr/lib/python3.10/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'ifconfig wlan0' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/data/data/com.termux/files/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/termux_ssh/__main__.py", line 74, in <module>
    Exception_Message(e)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/termux_ssh/termux.py", line 193, in Exception_Message
    print(BRIGHT_RED + Exception)
TypeError: can only concatenate str (not "CalledProcessError") to str

Seems that ifconfig wlan0 returns non-zero result due to permission problem.

However, if ifconfig is run instead of ifconfig wlan0, it is still usable and returns zero:

Warning: cannot open /proc/net/dev (Permission denied). Limited output.
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 1000  (UNSPEC)

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.5.14  netmask 255.255.255.0  broadcast 192.168.5.255
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 1000  (UNSPEC)

@dmdhrumilmistry
Copy link
Owner

Then the command list in README should be fixed.

thank you for bringing this to my attention, surely will update it in next commit.

The wlan ip command crashes Termux-SSH:

Termux-SSH >> wlan ip                                                                                                                                                                         
Warning: cannot open /proc/net/dev (Permission denied). Limited output.                                                                                                                       
[-] An Error occured while running the script, please create an issue on github to resolve issue and make script better.                                                                      
[*] Github URL: https://github.com/dmrdhrumilmistry/Termux-SSH                                                                                                                                
Traceback (most recent call last):                                                                                                                                                            
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/termux_ssh/__main__.py", line 57, in <module>
    wlan_ip = get_wlan_ip()
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/termux_ssh/termux.py", line 158, in get_wlan_ip
    wlan_info = subprocess.check_output("ifconfig wlan0", shell=True).decode('utf-8')
  File "/data/data/com.termux/files/usr/lib/python3.10/subprocess.py", line 420, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/data/data/com.termux/files/usr/lib/python3.10/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'ifconfig wlan0' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/data/data/com.termux/files/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/termux_ssh/__main__.py", line 74, in <module>
    Exception_Message(e)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/termux_ssh/termux.py", line 193, in Exception_Message
    print(BRIGHT_RED + Exception)
TypeError: can only concatenate str (not "CalledProcessError") to str

Seems that ifconfig wlan0 returns non-zero result due to permission problem.

However, if ifconfig is run instead of ifconfig wlan0, it is still usable and returns zero:

Warning: cannot open /proc/net/dev (Permission denied). Limited output.
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 1000  (UNSPEC)

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.5.14  netmask 255.255.255.0  broadcast 192.168.5.255
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 1000  (UNSPEC)

May I know, which Android and Termux version are you using so I can investigate?

@UlyssesZh
Copy link
Author

May I know, which Android and Termux version are you using so I can investigate?

  • Android 11
  • Termux 0.118.0
  • net-tools 2.10.0 (installed using pkg i net-tools)
  • Termux-SSH 1.0.0 (installed using pip3 install Termux-SSH)

@dmdhrumilmistry
Copy link
Owner

Will look into it, and try to release fixed version ASAP

@dmdhrumilmistry dmdhrumilmistry self-assigned this Aug 6, 2022
@dmdhrumilmistry dmdhrumilmistry added the bug Something isn't working label Aug 6, 2022
@dmdhrumilmistry dmdhrumilmistry linked a pull request Aug 6, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants