Do you know how to script in Python2.7? If not no worries, it's easy :D
Yes! You can write a dedicated script that pulls from the RfCat liberies (The software used to control CC1111 chips) and have them run independently from the RfCat interactive environment.
So here's what you'll need to do.
1.) You either need to have your script run the same directory where 'rfcat' is located or...
2.) Make a copy of the folders 'rflib' and 'vstruct' and and all their contents and put them in the same working directory of your script.
3.) Import the rflib libraries into your python script with 'from rflib import *'
4.) assign the function 'RfCat()' to 'd'
5.) set variables and make calls to each function as you would in RfCat
Here's a quick and dirty example on how to use RfCat in a python script. I didn't call any of the functions in the example below but you can use this as an example on how to format your script.
You can always read up on any RfCat function by typing in 'help(d)' while your in the rfcat interactive environment.
#Lets make a python script for RfCat!
#Example below deminstrates TX with ASK/OOK
#Imports all the liberys from rflib into your script
from rflib import *
#assign the function RfCat() to 'd'
d = RfCat()
#Just like in the interactive environment, you can set veriables by typing in 'd.FUNCTION(VALUE)'
#How to RX
while True: #or 'while not keystop()' if you want to kill the loop by hitting the enter key
packet, timestamp = d.RFrecv()
if VerifyPacket(packet): #sanity check, makes sure the packet is valid
time = datetime.datetime.fromtimestamp(ts).strftime('%H:%M:%S')
data = str(pkt.encode('hex'))
print "<*> %s: RX: %s" % (time,data)
#Example sanity check, if your packet dosen't start with 0x00a2888a after what you have the preamble set to
#this function will return False and 'if VerifyPacket(packet):' will not execute the commands below.
#It will loop back to 'while True:' and try again.
if ord(pkt) != 0x00:
if ord(pkt) != 0xa2:
if ord(pkt) != 0x88:
if ord(pkt) != 0x8a:
#Any data being TXed can be ASCII, decoded HEX, at least as far as I know :D
#d.RFxmit(data, repeat=0, offset=0)
#repeat of 65535 means 'forever'
#How to TX ASCII
#How to TX decoded HEX
#Hex hardcoded in, 0xff00ff is 111111110000000011111111 in binary and your ASK/OOK will look like that too!
#1 is on, 0 is off
#Hex in a veriable
HexMessage = '1234ffff0000' #starts as a string
d.RFxmit(HexMessage.decode('hex')) #decoded so RfCat is happy :D
If you want to learn more about RfCat I would recommend watching this.
Also I just finished a project using RfCat to reverse a Juke Box remote and made a small script that dose sends remote commands, passive PIN discovery, and brute forcing!
Here's a video series I recommend if you are brand new to Python. The video series teaches Python3 and even thou RfCat works with Python2.7, both versions of python are not that different. If you google the differences between Python2.7 and Python3 you'll see what I mean.
Let me know if you have any questions and happy hacking! :D