forked from atlas0fd00m/rfcat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrfcat
executable file
·68 lines (50 loc) · 2.54 KB
/
rfcat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env python3
from __future__ import print_function
import sys
import logging
import readline
import rlcompleter
readline.parse_and_bind("tab: complete")
from rflib import *
logging.basicConfig(level=logging.INFO, format='%(asctime)s:%(levelname)s:%(name)s: %(message)s')
logger = logging.getLogger(__name__)
intro = """'RfCat, the greatest thing since Frequency Hopping!'
Research Mode: enjoy the raw power of rflib
currently your environment has an object called "d" for dongle. this is how
you interact with the rfcat dongle:
>>> d.ping()
>>> d.setFreq(433000000)
>>> d.setMdmModulation(MOD_ASK_OOK)
>>> d.makePktFLEN(250)
>>> d.RFxmit(b"HALLO")
>>> d.RFrecv()
>>> print(d.reprRadioConfig())
"""
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-r', '--research', default=False, action="store_true", help='Interactive Python and the "d" instance to talk to your dongle. melikey longtime.')
parser.add_argument('-i', '--index', default=0, type=int)
parser.add_argument('-s', '--specan', default=False, action="store_true", help='start spectrum analyzer')
parser.add_argument('-f', '--centfreq', default=902e6, type=float)
parser.add_argument('-c', '--inc', default=250e3, type=float)
parser.add_argument('-n', '--specchans', default=104, type=int)
parser.add_argument('--bootloader', default=False, action="store_true", help='trigger the bootloader (use in order to flash the dongle)')
parser.add_argument('--force', default=False, action="store_true", help='use this to make sure you want to set bootloader mode (you *must* flash after setting --bootloader)')
parser.add_argument('-S', '--safemode', default=False, action="store_true", help='TROUBLESHOOTING ONLY, used with -r')
ifo = parser.parse_args()
if ifo.bootloader:
if not ifo.force:
print("Protecting you from yourself. If you want to trigger Bootloader mode (you will then *have* to flash a new RfCat image on it) use the --force argument as well")
exit(-1)
print("Entering RfCat Bootloader mode, ready for new image...")
RfCat(ifo.index, safemode=ifo.safemode).bootloader()
exit(0)
elif ifo.specan:
RfCat(ifo.index).specan(ifo.centfreq,ifo.inc,ifo.specchans)
elif ifo.research:
interactive(ifo.index, DongleClass=RfCat, intro=intro, safemode=ifo.safemode)
else:
# do the full-rfcat thing
d = RfCat(ifo.index, debug=False)
d.rf_redirection((sys.stdin, sys.stdout))