mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-24 01:08:32 +03:00
sniffer.py: Removed unused find_dev function
This commit is contained in:
@@ -10,44 +10,6 @@ from gsmtap import gsmtap_send_apdu
|
|||||||
|
|
||||||
from constants import PHONE_RD, ERR_TIMEOUT, ERR_NO_SUCH_DEV
|
from constants import PHONE_RD, ERR_TIMEOUT, ERR_NO_SUCH_DEV
|
||||||
|
|
||||||
def find_dev():
|
|
||||||
dev = usb.core.find(idVendor=0x03eb, idProduct=0x6004)
|
|
||||||
if dev is None:
|
|
||||||
raise ValueError("Device not found")
|
|
||||||
else:
|
|
||||||
print("Found device")
|
|
||||||
return dev
|
|
||||||
|
|
||||||
def find_eps(dev):
|
|
||||||
dev.set_configuration()
|
|
||||||
|
|
||||||
cfg = dev.get_active_configuration()
|
|
||||||
print("Active config: ")
|
|
||||||
print(cfg)
|
|
||||||
intf = cfg[(0,0)]
|
|
||||||
|
|
||||||
ep_in = usb.util.find_descriptor(
|
|
||||||
intf,
|
|
||||||
custom_match = \
|
|
||||||
lambda e: \
|
|
||||||
usb.util.endpoint_direction(e.bEndpointAddress) == \
|
|
||||||
usb.util.ENDPOINT_IN)
|
|
||||||
|
|
||||||
assert ep_in is not None
|
|
||||||
|
|
||||||
ep_out = usb.util.find_descriptor(
|
|
||||||
intf,
|
|
||||||
custom_match = \
|
|
||||||
lambda e: \
|
|
||||||
usb.util.endpoint_direction(e.bEndpointAddress) == \
|
|
||||||
usb.util.ENDPOINT_OUT)
|
|
||||||
|
|
||||||
assert ep_out is not None
|
|
||||||
print("****")
|
|
||||||
print(ep_in)
|
|
||||||
print(ep_out)
|
|
||||||
return (ep_in, ep_out)
|
|
||||||
|
|
||||||
# main code
|
# main code
|
||||||
def sniff(dev):
|
def sniff(dev):
|
||||||
ans = array.array('B', [])
|
ans = array.array('B', [])
|
||||||
@@ -56,7 +18,6 @@ def sniff(dev):
|
|||||||
apdu = Apdu_splitter()
|
apdu = Apdu_splitter()
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
#ep_out.write("Hello")
|
|
||||||
try:
|
try:
|
||||||
ans += dev.read(PHONE_RD, 64, 1000)
|
ans += dev.read(PHONE_RD, 64, 1000)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
|||||||
Reference in New Issue
Block a user