File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed
modules/exploits/linux/http Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -270,7 +270,7 @@ def exploit
270
270
# len(bin(self.sharedSecret)) - 2 // 8 + 1, byteorder="big"
271
271
# )
272
272
# 2(0b) + 1(- 2 // 8 + 1) = 3
273
- _sharedSecret = to_bytes ( sharedSecret , sharedSecret . to_s ( 2 ) . length + 3 , byteorder = "big" )
273
+ _sharedSecret = to_bytes ( sharedSecret , sharedSecret . to_s ( 2 ) . length + 3 , little_endian = false )
274
274
sha = OpenSSL ::Digest . new ( 'sha256' )
275
275
sha . update ( _sharedSecret )
276
276
session_key = sha . digest
@@ -405,12 +405,9 @@ def build_response_packet(tasking_id, packet_data)
405
405
packetType + totalPacket + packetNum + result_id + length + packet_data
406
406
end
407
407
408
- def to_bytes ( n , length = 1 , byteorder = 'big' , signed = false )
409
- raise ArgumentError , "byteorder must be either 'little' or 'big'" unless [ 'little' , 'big' ] . include? ( byteorder )
410
-
411
- order = ( byteorder == 'little' ) ? ( 0 ...length ) : ( 0 ...length ) . to_a . reverse
412
-
413
- bytes_array = order . map { |i | ( n >> i *8 ) & 0xff }
408
+ def to_bytes ( n , length = 1 , little_endian = false )
409
+ order = little_endian ? ( 0 ...length ) : ( 0 ...length ) . to_a . reverse
410
+ bytes_array = order . map { |i | ( n >> i * 8 ) & 0xff }
414
411
bytes_array . pack ( 'C*' )
415
412
end
416
413
You can’t perform that action at this time.
0 commit comments