mirror of https://github.com/hak5/ToorChat.git
Merge branch 'master' of https://github.com/hathcox/ToorChat
commit
7d7ed2d074
|
@ -6,10 +6,11 @@ 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())
|
||||
print msg.to_string()
|
||||
|
||||
@classmethod
|
||||
def get_packet_start(cls):
|
||||
|
@ -32,6 +33,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:
|
||||
print 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\n")
|
||||
protocol.send_message(send)
|
||||
except ChipconUsbTimeoutException:
|
||||
pass
|
||||
|
||||
|
|
Loading…
Reference in New Issue