mirror of https://github.com/hak5/ToorChat.git
Added updates to protocol
parent
1515b9358c
commit
26fc794551
|
@ -19,10 +19,12 @@ def get_web_site(visual, site):
|
||||||
connection = httplib.HTTPConnection(site)
|
connection = httplib.HTTPConnection(site)
|
||||||
connection.request("GET", "/")
|
connection.request("GET", "/")
|
||||||
result = connection.getresponse().read()
|
result = connection.getresponse().read()
|
||||||
result_list = string_into_even_peices(result, 100)
|
result_list = string_into_even_peices(result, 200)
|
||||||
site_xid = os.urandom(8)
|
site_xid = os.urandom(8)
|
||||||
|
length = "%0*d" % (2, len(result_list))
|
||||||
for index, item in enumerate(result_list):
|
for index, item in enumerate(result_list):
|
||||||
msg = ToorMessage(item, None, ToorChatProtocol.get_web_response_type(), site_xid, str(index), )
|
msg = ToorMessage(item, None, ToorChatProtocol.get_web_response_type(), site_xid, str(index), length)
|
||||||
|
visual.protocol.send_message(msg)
|
||||||
# visual.message_queue.append(msg)
|
# visual.message_queue.append(msg)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print e
|
print e
|
||||||
|
@ -41,6 +43,10 @@ class ToorChatProtocol():
|
||||||
self.device.RFxmit(msg.to_string())
|
self.device.RFxmit(msg.to_string())
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
|
def send_message(self, message):
|
||||||
|
''' Send off a ToorMessage Object '''
|
||||||
|
self.device.RFxmit(message.to_string())
|
||||||
|
|
||||||
def change_channel(self, channel):
|
def change_channel(self, channel):
|
||||||
''' This is used to change the channel that the user operates in '''
|
''' This is used to change the channel that the user operates in '''
|
||||||
if isinstance(channel, int):
|
if isinstance(channel, int):
|
||||||
|
@ -69,10 +75,10 @@ class ToorChatProtocol():
|
||||||
message.start = raw_message[start_index:start_index + 4]
|
message.start = raw_message[start_index:start_index + 4]
|
||||||
message.xid = raw_message[start_index + 4: start_index + 12]
|
message.xid = raw_message[start_index + 4: start_index + 12]
|
||||||
message.type = raw_message[start_index + 12: start_index + 14]
|
message.type = raw_message[start_index + 12: start_index + 14]
|
||||||
message.index = raw_message[start_index + 14: start_index + 16]
|
message.index = raw_message[start_index + 14: start_index + 18]
|
||||||
message.last = raw_message[start_index + 16: start_index + 18]
|
message.last = raw_message[start_index + 18: start_index + 22]
|
||||||
message.user = raw_message[start_index + 18: start_index + 26]
|
message.user = raw_message[start_index + 22: start_index + 30]
|
||||||
message.data = raw_message[start_index + 26: end_index]
|
message.data = raw_message[start_index + 30: end_index]
|
||||||
message.end = raw_message[end_index: end_index+4]
|
message.end = raw_message[end_index: end_index+4]
|
||||||
return message
|
return message
|
||||||
|
|
||||||
|
@ -108,7 +114,7 @@ class ToorMessage():
|
||||||
''' This is confusing as shit so here is a diagram to attempt to help us all out '''
|
''' This is confusing as shit so here is a diagram to attempt to help us all out '''
|
||||||
''' ___________________________________________________________________________ '''
|
''' ___________________________________________________________________________ '''
|
||||||
'''| Start | XID | Type | Index | Last | User | Data | End | '''
|
'''| Start | XID | Type | Index | Last | User | Data | End | '''
|
||||||
'''|___4___|__8__|__2___|___2___|__2___|__8___|_________100-200__________|__4__| '''
|
'''|___4___|__8__|__2___|___4___|__4___|__8___|_________100-200__________|__4__| '''
|
||||||
|
|
||||||
''' The numbers represent the number of byte in a given message '''
|
''' The numbers represent the number of byte in a given message '''
|
||||||
''' Note: The more data bytes we use, the harder it is to catch over the air '''
|
''' Note: The more data bytes we use, the harder it is to catch over the air '''
|
||||||
|
@ -138,7 +144,7 @@ class ToorMessage():
|
||||||
return os.urandom(8)
|
return os.urandom(8)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.start + self.xid + self.type + self.index + self.last + self.user + self.data + self.end
|
return self.start + self.xid + self.type + str(self.index) + str(self.last) + self.user + self.data + self.end
|
||||||
|
|
||||||
def to_string(self):
|
def to_string(self):
|
||||||
return self.__str__()
|
return self.__str__()
|
||||||
|
|
|
@ -21,7 +21,7 @@ def thread_run(visual):
|
||||||
if toor_message.type == ToorChatProtocol.get_chat_type():
|
if toor_message.type == ToorChatProtocol.get_chat_type():
|
||||||
visual.message_queue.append(toor_message)
|
visual.message_queue.append(toor_message)
|
||||||
if toor_message.type == ToorChatProtocol.get_web_request_type():
|
if toor_message.type == ToorChatProtocol.get_web_request_type():
|
||||||
#If we are registered as a server, lets typ to make that request
|
#If we are registered as a server, lets type to make that request
|
||||||
if visual.server:
|
if visual.server:
|
||||||
ToorChatProtocol.get_web_messages(toor_message.data, visual)
|
ToorChatProtocol.get_web_messages(toor_message.data, visual)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue