mirror of https://github.com/hak5/ToorChat.git
Added recv_loop and updates
parent
0a43947937
commit
82724f2bc7
|
@ -6,10 +6,10 @@ class ToorChatProtocol():
|
|||
self.PACKET_END = "\xFF\xBE\xEF\xFF"
|
||||
self.device = device
|
||||
|
||||
def send_message(cls, message = "", user = None):
|
||||
def send_message(self, message = "", user = None):
|
||||
''' This is used to send a simple message over the toorchat protocol '''
|
||||
msg = ToorChatMessage(message, user)
|
||||
self.device.RFxmit(msg)
|
||||
self.device.RFxmit(msg.to_string())
|
||||
|
||||
@classmethod
|
||||
def get_packet_start(cls):
|
||||
|
@ -32,6 +32,9 @@ class ToorChatMessage():
|
|||
self.data = message
|
||||
self.end = ToorChatProtocol.get_packet_end()
|
||||
|
||||
def get_random_xid(self):
|
||||
return "44444444"
|
||||
|
||||
def __str__(self):
|
||||
return self.start + self.xid + self.user + self.data + self.end
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
from rflib import *
|
||||
import rflib.chipcon_nic as rfnic
|
||||
import atexit
|
||||
from libtoorchat import *
|
||||
|
||||
def banner():
|
||||
print "******** ToorChat [v 0.1] ********"
|
||||
|
||||
def main():
|
||||
banner()
|
||||
badge = RfCat(idx=0)
|
||||
badge.setModeRX()
|
||||
protocol = ToorChatProtocol(badge)
|
||||
while True:
|
||||
try:
|
||||
msg, timestamp = badge.RFrecv()
|
||||
print msg
|
||||
except ChipconUsbTimeoutException:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -16,10 +16,10 @@ def main():
|
|||
protocol = ToorChatProtocol(badge)
|
||||
while True:
|
||||
try:
|
||||
msg, timestamp = badge.RFrecv()
|
||||
print "enter a message"
|
||||
# send = input("Enter a message")
|
||||
# protocol.send_message(send)
|
||||
# msg, timestamp = badge.RFrecv()
|
||||
# print "enter a message"
|
||||
send = raw_input("Enter a message")
|
||||
protocol.send_message(send)
|
||||
except ChipconUsbTimeoutException:
|
||||
pass
|
||||
|
||||
|
|
Loading…
Reference in New Issue