Changeset 1045
- Timestamp:
- 03/30/08 15:51:03 (8 months ago)
- Files:
-
- fwknop/trunk/ChangeLog (modified) (1 diff)
- fwknop/trunk/fwknop (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
fwknop/trunk/ChangeLog
r1044 r1045 12 12 IP does not have to be manually defined. However, the external IP can 13 13 be defined by the SNAT_TRANSLATE_IP variable. 14 - Added hex_dump() feature for fwknop client so that raw encrypted SPA 15 packet data can be displayed in --verbose mode. 14 16 - When ENABLE_IPT_FORWARDING is set, added a check for the value of the 15 17 /proc/sys/net/ipv4/ip_forward file to ensure that the local system fwknop/trunk/fwknop
r1039 r1045 684 684 } 685 685 686 if ($verbose) { 687 print "[+] Encrypted msg hex dump (" . 688 length($ctext) . " bytes):\n"; 689 &hex_dump($ctext); 690 } 691 686 692 my $encoded_msg = encode_base64($ctext, ''); 687 693 … … 696 702 { 697 703 'key' => $enc_key, 698 'cipher' => $enc_alg 704 'cipher' => $enc_alg, 699 705 } 700 706 ); 701 my $encoded_msg = encode_base64($cipher->encrypt($msg), ''); 707 708 my $encrypted_msg = $cipher->encrypt($msg); 709 710 if ($verbose) { 711 print "\n[+] Encrypted msg hex dump before base64 encoding (" . 712 length($encrypted_msg) . " bytes):\n"; 713 &hex_dump($encrypted_msg); 714 } 715 716 my $encoded_msg = encode_base64($encrypted_msg, ''); 702 717 703 718 ### Crypt::CBC adds the string "Salted__" to the beginning of the … … 1512 1527 die "[*] --digest-alg can accept one of MD5, SHA1, or SHA256"; 1513 1528 } 1529 return; 1530 } 1531 1532 sub hex_dump() { 1533 my $data = shift; 1534 1535 my @chars = split //, $data; 1536 my $ctr = 0; 1537 my $ascii_str = ''; 1538 for my $char (@chars) { 1539 if ($ctr % 16 == 0) { 1540 print " $ascii_str\n" if $ascii_str; 1541 printf " 0x%.4x: ", $ctr; 1542 $ascii_str = ''; 1543 } 1544 printf "%.2x", ord($char); 1545 1546 if ((($ctr+1) % 2 == 0) and ($ctr % 16 != 0)) { 1547 print ' '; 1548 } 1549 1550 if ($char =~ /[^\x20-\x7e]/) { 1551 $ascii_str .= '.'; 1552 } else { 1553 $ascii_str .= $char; 1554 } 1555 $ctr++; 1556 } 1557 if ($ascii_str) { 1558 my $remainder = 1; 1559 if ($ctr % 16 != 0) { 1560 $remainder = 16 - $ctr % 16; 1561 if ($remainder % 2 == 0) { 1562 $remainder = 2*$remainder + int($remainder/2) + 1; 1563 } else { 1564 $remainder = 2*$remainder + int($remainder/2) + 2; 1565 } 1566 } 1567 print ' 'x$remainder, $ascii_str; 1568 } 1569 print "\n"; 1514 1570 return; 1515 1571 }
