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

IndexError: list index out of range #1

Closed
ghost opened this issue May 8, 2016 · 5 comments
Closed

IndexError: list index out of range #1

ghost opened this issue May 8, 2016 · 5 comments
Assignees

Comments

@ghost
Copy link

ghost commented May 8, 2016

Version:
3987c96

Distribution:
Kali 2016

Description:
Fails to show the available modes for a selected card. Note that the modes for the first card is returned back without any error but fails on the second card.

Steps to Reproduce:
Running a file with the following contents:

import PyRIC.pyric.pyw as pyw

# list wireless interfaces
interfaces = pyw.winterfaces()
print "Wireless Interfaces: ", interfaces

for interface in interfaces:
    card = pyw.getcard(interface)
    print card
    print pyw.devmodes(card)

Script Output:

Wireless Interfaces:  ['wlx00c0ca81e2d8', 'wlx00c0ca6da2a4']
Card(phy=6,dev=wlx00c0ca81e2d8,ifindex=9)
['ibss', 'managed', 'monitor']
Card(phy=5,dev=wlx00c0ca6da2a4,ifindex=8)
Traceback (most recent call last):
  File "t.py", line 16, in <module>
    print pyw.devmodes(card)
  File "/home/blackhatmonkey/Downloads/PyRIC/pyric/pyw.py", line 433, in devmodes
    return _nlstub_(devmodes,card)
  File "/home/blackhatmonkey/Downloads/PyRIC/pyric/pyw.py", line 846, in _nlstub_
    return fct(*argv)
  File "/home/blackhatmonkey/Downloads/PyRIC/pyric/pyw.py", line 435, in devmodes
    return phyinfo(card,nlsock)['modes']
  File "/home/blackhatmonkey/Downloads/PyRIC/pyric/pyw.py", line 552, in phyinfo
    info['modes'] = [IFTYPES[struct.unpack('>H', mode)[0]] for mode in modes]
IndexError: list index out of range
@wraith-wireless wraith-wireless self-assigned this May 8, 2016
@wraith-wireless
Copy link
Owner

wraith-wireless commented May 8, 2016

I cannot recreate this on my system, I have two wireless cards, doing the same as above, the modes for both can be enumerated. Do me a favor please. Can you give me the results from the following?

  1. uname -r (from the terminal)
  2. device.ifdriver('wlx00c0ca6da2a4') (from python)
  3. the results from iw phy phy6 info, particularly the modes listed there

Then, in pyw.py line 552 make info['modes'] = modes and show me the results. It must be a an IFTYPE I don't have in the list.

@ghost
Copy link
Author

ghost commented May 8, 2016

blackhatmonkey@Desktop1:~$ uname -r
4.4.0-21-generic
ath9k_htc
max # scan SSIDs: 4
        max scan IEs length: 2257 bytes
        Retry short limit: 7
        Retry long limit: 4
        Coverage class: 0 (up to 0m)
        Device supports RSN-IBSS.
        Device supports T-DLS.
        Supported Ciphers:
                * WEP40 (00-0f-ac:1)
                * WEP104 (00-0f-ac:5)
                * TKIP (00-0f-ac:2)
                * CCMP (00-0f-ac:4)
                * 00-0f-ac:10
                * GCMP (00-0f-ac:8)
                * 00-0f-ac:9
                * CMAC (00-0f-ac:6)
                * 00-0f-ac:13
                * 00-0f-ac:11
                * 00-0f-ac:12
        Available Antennas: TX 0x1 RX 0x1
        Configured Antennas: TX 0x1 RX 0x1
        Supported interface modes:
                 * IBSS
                 * managed
                 * AP
                 * AP/VLAN
                 * monitor
                 * mesh point
                 * P2P-client
                 * P2P-GO
                 * Unknown mode (11)
        Band 1:
                Capabilities: 0x116e
                        HT20/HT40
                        SM Power Save disabled
                        RX HT20 SGI
                        RX HT40 SGI
                        RX STBC 1-stream
                        Max AMSDU length: 3839 bytes
                        DSSS/CCK HT40
                Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
                Minimum RX AMPDU time spacing: 8 usec (0x06)
                HT TX/RX MCS rate indexes supported: 0-7
                Bitrates (non-HT):
                        * 1.0 Mbps
                        * 2.0 Mbps (short preamble supported)
                        * 5.5 Mbps (short preamble supported)
                        * 11.0 Mbps (short preamble supported)
                        * 6.0 Mbps
                        * 9.0 Mbps
                        * 12.0 Mbps
                        * 18.0 Mbps
                        * 24.0 Mbps
                        * 36.0 Mbps
                        * 48.0 Mbps
                        * 54.0 Mbps
                Frequencies:
                        * 2412 MHz [1] (20.0 dBm)
                        * 2417 MHz [2] (20.0 dBm)
                        * 2422 MHz [3] (20.0 dBm)
                        * 2427 MHz [4] (20.0 dBm)
                        * 2432 MHz [5] (20.0 dBm)
                        * 2437 MHz [6] (20.0 dBm)
                        * 2442 MHz [7] (20.0 dBm)
                        * 2447 MHz [8] (20.0 dBm)
                        * 2452 MHz [9] (20.0 dBm)
                        * 2457 MHz [10] (20.0 dBm)
                        * 2462 MHz [11] (20.0 dBm)
                        * 2467 MHz [12] (20.0 dBm)
                        * 2472 MHz [13] (20.0 dBm)
                        * 2484 MHz [14] (disabled)
        Supported commands:
                 * new_interface
                 * set_interface
                 * new_key
                 * start_ap
                 * new_station
                 * new_mpath
                 * set_mesh_config
                 * set_bss
                 * authenticate
                 * associate
                 * deauthenticate
                 * disassociate
                 * join_ibss
                 * join_mesh
                 * remain_on_channel
                 * set_tx_bitrate_mask
                 * frame
                 * frame_wait_cancel
                 * set_wiphy_netns
                 * set_channel
                 * set_wds_peer
                 * tdls_mgmt
                 * tdls_oper
                 * probe_client
                 * set_noack_map
                 * register_beacons
                 * start_p2p_device
                 * set_mcast_rate
                 * channel_switch
                 * Unknown command (104)
                 * connect
                 * disconnect
        Supported TX frame types:
                 * IBSS: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * mesh point: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * P2P-device: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
        Supported RX frame types:
                 * IBSS: 0x40 0xb0 0xc0 0xd0
                 * managed: 0x40 0xd0
                 * AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
                 * AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
                 * mesh point: 0xb0 0xc0 0xd0
                 * P2P-client: 0x40 0xd0
                 * P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
                 * P2P-device: 0x40 0xd0
        software interface modes (can always be added):
                 * AP/VLAN
                 * monitor
        valid interface combinations:
                 * #{ managed, P2P-client } <= 2, #{ AP, mesh point, P2P-GO } <= 2,
                   total <= 2, #channels <= 1
        HT Capability overrides:
                 * MCS: ff ff ff ff ff ff ff ff ff ff
                 * maximum A-MSDU length
                 * supported channel width
                 * short GI for 40 MHz
                 * max A-MPDU length exponent
                 * min MPDU start spacing
        Device supports TX status socket option.
        Device supports HT-IBSS.
        Device supports SAE with AUTHENTICATE command
        Device supports low priority scan.
        Device supports scan flush.
        Device supports AP scan.
        Device supports per-vif TX power setting
        Driver supports a userspace MPM
['\x00\x01', '\x00\x02', '\x00\x03', '\x00\x04', '\x00\x06', '\x00\x07', '\x00\x08', '\x00\t', '\x00\x0b']

And thanks for your hard work 😄

@wraith-wireless
Copy link
Owner

It's Unknown mode (11) causing the probelm, I'll add a wrapper around the IFTYPES list to handle it.

Done, see the new pyw

@ghost
Copy link
Author

ghost commented May 9, 2016

After pulling the latest I get the following error:

Traceback (most recent call last):
  File "t.py", line 2, in <module>
    import PyRIC.pyric.pyw as pyw
  File "/home/blackhatmonkey/Downloads/PyRIC/pyric/pyw.py", line 113, in <module>
    import pyric,errno                              # pyric exception & error codes
ImportError: No module named pyric

@wraith-wireless
Copy link
Owner

wraith-wireless commented May 9, 2016

Yeah when I moved everything under the root PyRIC directory so setup.py could package everything the paths got all jacked up. I having the same problem. Try creating a file 'pyric.pth' in /usr/lib/python2.7/dist-packages with the line:

/home/blackhatmonkey/Downloads/PyRIC/pyric/ in it.

You might have to close all terminals first too.

I think, I might just have to delete this repository and recreate with the toplevel PyRIC, will have to work out something else IOT package it for pypi. If the repository dissappears again then it means I had recreate it.

Oh yeah, and when you import it will just be:

from pyric import pyw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant