tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

index.rst (16841B)


      1 .. _mozilla_projects_nss_reference_nss_tools_:_ssltap:
      2 
      3 NSS tools : ssltap
      4 ==================
      5 
      6 .. container::
      7 
      8   Name
      9 
     10   ssltap — Tap into SSL connections and display the data going by
     11 
     12   Synopsis
     13 
     14   libssltap [-vhfsxl] [-p port] [hostname:port]
     15 
     16   Description
     17 
     18   | The SSL Debugging Tool ssltap is an SSL-aware command-line proxy. It
     19   | watches TCP connections and displays the data going by. If a connection is
     20   | SSL, the data display includes interpreted SSL records and handshaking
     21 
     22   Options
     23 
     24   -v
     25 
     26   Print a version string for the tool.
     27 
     28   -h
     29 
     30   | Turn on hex/ASCII printing. Instead of outputting raw data, the
     31   | command interprets each record as a numbered line of hex values,
     32   | followed by the same data as ASCII characters. The two parts are
     33   | separated by a vertical bar. Nonprinting characters are replaced
     34   | by dots.
     35 
     36   -f
     37 
     38   | Turn on fancy printing. Output is printed in colored HTML. Data
     39   | sent from the client to the server is in blue; the server's reply
     40   | is in red. When used with looping mode, the different connections
     41   | are separated with horizontal lines. You can use this option to
     42   | upload the output into a browser.
     43 
     44   -s
     45 
     46   | Turn on SSL parsing and decoding. The tool does not automatically
     47   | detect SSL sessions. If you are intercepting an SSL connection,
     48   | use this option so that the tool can detect and decode SSL
     49   | structures.
     50 
     51   | If the tool detects a certificate chain, it saves the DER-encoded
     52   | certificates into files in the current directory. The files are
     53   | named cert.0x, where x is the sequence number of the certificate.
     54 
     55   | If the -s option is used with -h, two separate parts are printed
     56   | for each record: the plain hex/ASCII output, and the parsed SSL
     57   | output.
     58 
     59   -x
     60 
     61   | Turn on hex/ASCII printing of undecoded data inside parsed SSL
     62   | records. Used only with the -s option. This option uses the same
     63   | output format as the -h option.
     64 
     65   -l prefix
     66 
     67   | Turn on looping; that is, continue to accept connections rather
     68   | than stopping after the first connection is complete.
     69 
     70   -p port
     71 
     72   Change the default rendezvous port (1924) to another port.
     73 
     74   The following are well-known port numbers:
     75 
     76   \* HTTP 80
     77 
     78   \* HTTPS 443
     79 
     80   \* SMTP 25
     81 
     82   \* FTP 21
     83 
     84   \* IMAP 143
     85 
     86   \* IMAPS 993 (IMAP over SSL)
     87 
     88   \* NNTP 119
     89 
     90   \* NNTPS 563 (NNTP over SSL)
     91 
     92   Usage and Examples
     93 
     94   | You can use the SSL Debugging Tool to intercept any connection
     95   | information. Although you can run the tool at its most basic by issuing
     96   | the ssltap command with no options other than hostname:port, the
     97   | information you get in this way is not very useful. For example, assume
     98   | your development machine is called intercept. The simplest way to use the
     99   | debugging tool is to execute the following command from a command shell:
    100 
    101   $ ssltap www.netscape.com
    102 
    103   | The program waits for an incoming connection on the default port 1924. In
    104   | your browser window, enter the URL http://intercept:1924. The browser
    105   | retrieves the requested page from the server at www.netscape.com, but the
    106   | page is intercepted and passed on to the browser by the debugging tool on
    107   | intercept. On its way to the browser, the data is printed to the command
    108   | shell from which you issued the command. Data sent from the client to the
    109   | server is surrounded by the following symbols: --> [ data ] Data sent from
    110   | the server to the client is surrounded by the following symbols: "left
    111   | arrow"-- [ data ] The raw data stream is sent to standard output and is
    112   | not interpreted in any way. This can result in peculiar effects, such as
    113   | sounds, flashes, and even crashes of the command shell window. To output a
    114   | basic, printable interpretation of the data, use the -h option, or, if you
    115   | are looking at an SSL connection, the -s option. You will notice that the
    116   | page you retrieved looks incomplete in the browser. This is because, by
    117   | default, the tool closes down after the first connection is complete, so
    118   | the browser is not able to load images. To make the tool continue to
    119   | accept connections, switch on looping mode with the -l option. The
    120   | following examples show the output from commonly used combinations of
    121   | options.
    122 
    123   Example 1
    124 
    125   $ ssltap.exe -sx -p 444 interzone.mcom.com:443 > sx.txt
    126 
    127   Output
    128 
    129   | Connected to interzone.mcom.com:443
    130   | -->; [
    131   | alloclen = 66 bytes
    132   | [ssl2] ClientHelloV2 {
    133   | version = {0x03, 0x00}
    134   | cipher-specs-length = 39 (0x27)
    135   | sid-length = 0 (0x00)
    136   | challenge-length = 16 (0x10)
    137   | cipher-suites = {
    138 
    139   | (0x010080) SSL2/RSA/RC4-128/MD5
    140   | (0x020080) SSL2/RSA/RC4-40/MD5
    141   | (0x030080) SSL2/RSA/RC2CBC128/MD5
    142   | (0x040080) SSL2/RSA/RC2CBC40/MD5
    143   | (0x060040) SSL2/RSA/DES64CBC/MD5
    144   | (0x0700c0) SSL2/RSA/3DES192EDE-CBC/MD5
    145   | (0x000004) SSL3/RSA/RC4-128/MD5
    146   | (0x00ffe0) SSL3/RSA-FIPS/3DES192EDE-CBC/SHA
    147   | (0x00000a) SSL3/RSA/3DES192EDE-CBC/SHA
    148   | (0x00ffe1) SSL3/RSA-FIPS/DES64CBC/SHA
    149   | (0x000009) SSL3/RSA/DES64CBC/SHA
    150   | (0x000003) SSL3/RSA/RC4-40/MD5
    151   | (0x000006) SSL3/RSA/RC2CBC40/MD5
    152   | }
    153   | session-id = { }
    154   | challenge = { 0xec5d 0x8edb 0x37c9 0xb5c9 0x7b70 0x8fe9 0xd1d3
    155 
    156   | 0x2592 }
    157   | }
    158   | ]
    159   | <-- [
    160   | SSLRecord {
    161   | 0: 16 03 00 03 e5 \|.....
    162   | type = 22 (handshake)
    163   | version = { 3,0 }
    164   | length = 997 (0x3e5)
    165   | handshake {
    166   | 0: 02 00 00 46 \|...F
    167   | type = 2 (server_hello)
    168   | length = 70 (0x000046)
    169   | ServerHello {
    170   | server_version = {3, 0}
    171   | random = {...}
    172   | 0: 77 8c 6e 26 6c 0c ec c0 d9 58 4f 47 d3 2d 01 45 \|
    173   | wn&l.ì..XOG.-.E
    174   | 10: 5c 17 75 43 a7 4c 88 c7 88 64 3c 50 41 48 4f 7f \|
    175 
    176   | \\.uC§L.Ç.d<PAHO.
    177   | session ID = {
    178   | length = 32
    179 
    180   | contents = {..}
    181   | 0: 14 11 07 a8 2a 31 91 29 11 94 40 37 57 10 a7 32 \| ...¨*1.)..@7W.§2
    182   | 10: 56 6f 52 62 fe 3d b3 65 b1 e4 13 0f 52 a3 c8 f6 \| VoRbþ=³e±...R£È.
    183   | }
    184   | cipher_suite = (0x0003) SSL3/RSA/RC4-40/MD5
    185   | }
    186   | 0: 0b 00 02 c5 \|...Å
    187   | type = 11 (certificate)
    188   | length = 709 (0x0002c5)
    189   | CertificateChain {
    190   | chainlength = 706 (0x02c2)
    191   | Certificate {
    192   | size = 703 (0x02bf)
    193   | data = { saved in file 'cert.001' }
    194   | }
    195   | }
    196   | 0: 0c 00 00 ca \|....
    197   | type = 12 (server_key_exchange)
    198   | length = 202 (0x0000ca)
    199   | 0: 0e 00 00 00 \|....
    200   | type = 14 (server_hello_done)
    201   | length = 0 (0x000000)
    202   | }
    203   | }
    204   | ]
    205   | --> [
    206   | SSLRecord {
    207   | 0: 16 03 00 00 44 \|....D
    208   | type = 22 (handshake)
    209   | version = { 3,0 }
    210   | length = 68 (0x44)
    211   | handshake {
    212   | 0: 10 00 00 40 \|...@
    213   | type = 16 (client_key_exchange)
    214   | length = 64 (0x000040)
    215   | ClientKeyExchange {
    216   | message = {...}
    217   | }
    218   | }
    219   | }
    220   | ]
    221   | --> [
    222   | SSLRecord {
    223   | 0: 14 03 00 00 01 \|.....
    224   | type = 20 (change_cipher_spec)
    225   | version = { 3,0 }
    226   | length = 1 (0x1)
    227   | 0: 01 \|.
    228   | }
    229   | SSLRecord {
    230   | 0: 16 03 00 00 38 \|....8
    231   | type = 22 (handshake)
    232   | version = { 3,0 }
    233   | length = 56 (0x38)
    234   | < encrypted >
    235 
    236   | }
    237   | ]
    238   | <-- [
    239   | SSLRecord {
    240   | 0: 14 03 00 00 01 \|.....
    241   | type = 20 (change_cipher_spec)
    242   | version = { 3,0 }
    243   | length = 1 (0x1)
    244   | 0: 01 \|.
    245   | }
    246   | ]
    247   | <-- [
    248   | SSLRecord {
    249   | 0: 16 03 00 00 38 \|....8
    250   | type = 22 (handshake)
    251   | version = { 3,0 }
    252   | length = 56 (0x38)
    253   | < encrypted >
    254 
    255   | }
    256   | ]
    257   | --> [
    258   | SSLRecord {
    259   | 0: 17 03 00 01 1f \|.....
    260   | type = 23 (application_data)
    261   | version = { 3,0 }
    262   | length = 287 (0x11f)
    263   | < encrypted >
    264   | }
    265   | ]
    266   | <-- [
    267   | SSLRecord {
    268   | 0: 17 03 00 00 a0 \|....
    269   | type = 23 (application_data)
    270   | version = { 3,0 }
    271   | length = 160 (0xa0)
    272   | < encrypted >
    273 
    274   | }
    275   | ]
    276   | <-- [
    277   | SSLRecord {
    278   | 0: 17 03 00 00 df \|....ß
    279   | type = 23 (application_data)
    280   | version = { 3,0 }
    281   | length = 223 (0xdf)
    282   | < encrypted >
    283 
    284   | }
    285   | SSLRecord {
    286   | 0: 15 03 00 00 12 \|.....
    287   | type = 21 (alert)
    288   | version = { 3,0 }
    289   | length = 18 (0x12)
    290   | < encrypted >
    291   | }
    292   | ]
    293   | Server socket closed.
    294 
    295   Example 2
    296 
    297   | The -s option turns on SSL parsing. Because the -x option is not used in
    298   | this example, undecoded values are output as raw data. The output is
    299   | routed to a text file.
    300 
    301   $ ssltap -s -p 444 interzone.mcom.com:443 > s.txt
    302 
    303   Output
    304 
    305   | Connected to interzone.mcom.com:443
    306   | --> [
    307   | alloclen = 63 bytes
    308   | [ssl2] ClientHelloV2 {
    309   | version = {0x03, 0x00}
    310   | cipher-specs-length = 36 (0x24)
    311   | sid-length = 0 (0x00)
    312   | challenge-length = 16 (0x10)
    313   | cipher-suites = {
    314   | (0x010080) SSL2/RSA/RC4-128/MD5
    315   | (0x020080) SSL2/RSA/RC4-40/MD5
    316   | (0x030080) SSL2/RSA/RC2CBC128/MD5
    317   | (0x060040) SSL2/RSA/DES64CBC/MD5
    318   | (0x0700c0) SSL2/RSA/3DES192EDE-CBC/MD5
    319   | (0x000004) SSL3/RSA/RC4-128/MD5
    320   | (0x00ffe0) SSL3/RSA-FIPS/3DES192EDE-CBC/SHA
    321   | (0x00000a) SSL3/RSA/3DES192EDE-CBC/SHA
    322   | (0x00ffe1) SSL3/RSA-FIPS/DES64CBC/SHA
    323   | (0x000009) SSL3/RSA/DES64CBC/SHA
    324   | (0x000003) SSL3/RSA/RC4-40/MD5
    325   | }
    326   | session-id = { }
    327   | challenge = { 0x713c 0x9338 0x30e1 0xf8d6 0xb934 0x7351 0x200c
    328   | 0x3fd0 }
    329   | ]
    330   | >-- [
    331   | SSLRecord {
    332   | type = 22 (handshake)
    333   | version = { 3,0 }
    334   | length = 997 (0x3e5)
    335   | handshake {
    336   | type = 2 (server_hello)
    337   | length = 70 (0x000046)
    338   | ServerHello {
    339   | server_version = {3, 0}
    340   | random = {...}
    341   | session ID = {
    342   | length = 32
    343   | contents = {..}
    344   | }
    345   | cipher_suite = (0x0003) SSL3/RSA/RC4-40/MD5
    346   | }
    347   | type = 11 (certificate)
    348   | length = 709 (0x0002c5)
    349   | CertificateChain {
    350   | chainlength = 706 (0x02c2)
    351   | Certificate {
    352   | size = 703 (0x02bf)
    353   | data = { saved in file 'cert.001' }
    354   | }
    355   | }
    356   | type = 12 (server_key_exchange)
    357   | length = 202 (0x0000ca)
    358   | type = 14 (server_hello_done)
    359   | length = 0 (0x000000)
    360   | }
    361   | }
    362   | ]
    363   | --> [
    364   | SSLRecord {
    365   | type = 22 (handshake)
    366   | version = { 3,0 }
    367   | length = 68 (0x44)
    368   | handshake {
    369   | type = 16 (client_key_exchange)
    370   | length = 64 (0x000040)
    371   | ClientKeyExchange {
    372   | message = {...}
    373   | }
    374   | }
    375   | }
    376   | ]
    377   | --> [
    378   | SSLRecord {
    379   | type = 20 (change_cipher_spec)
    380   | version = { 3,0 }
    381   | length = 1 (0x1)
    382   | }
    383   | SSLRecord {
    384   | type = 22 (handshake)
    385   | version = { 3,0 }
    386   | length = 56 (0x38)
    387   | > encrypted >
    388   | }
    389   | ]
    390   | >-- [
    391   | SSLRecord {
    392   | type = 20 (change_cipher_spec)
    393   | version = { 3,0 }
    394   | length = 1 (0x1)
    395   | }
    396   | ]
    397   | >-- [
    398   | SSLRecord {
    399   | type = 22 (handshake)
    400   | version = { 3,0 }
    401   | length = 56 (0x38)
    402   | > encrypted >
    403   | }
    404   | ]
    405   | --> [
    406   | SSLRecord {
    407   | type = 23 (application_data)
    408   | version = { 3,0 }
    409   | length = 287 (0x11f)
    410   | > encrypted >
    411   | }
    412   | ]
    413   | [
    414   | SSLRecord {
    415   | type = 23 (application_data)
    416   | version = { 3,0 }
    417   | length = 160 (0xa0)
    418   | > encrypted >
    419   | }
    420   | ]
    421   | >-- [
    422   | SSLRecord {
    423   | type = 23 (application_data)
    424   | version = { 3,0 }
    425   | length = 223 (0xdf)
    426   | > encrypted >
    427   | }
    428   | SSLRecord {
    429   | type = 21 (alert)
    430   | version = { 3,0 }
    431   | length = 18 (0x12)
    432   | > encrypted >
    433   | }
    434   | ]
    435   | Server socket closed.
    436 
    437   Example 3
    438 
    439   | In this example, the -h option turns hex/ASCII format. There is no SSL
    440   | parsing or decoding. The output is routed to a text file.
    441 
    442   $ ssltap -h -p 444 interzone.mcom.com:443 > h.txt
    443 
    444   Output
    445 
    446   | Connected to interzone.mcom.com:443
    447   | --> [
    448   | 0: 80 40 01 03 00 00 27 00 00 00 10 01 00 80 02 00 \| .@....'.........
    449   | 10: 80 03 00 80 04 00 80 06 00 40 07 00 c0 00 00 04 \| .........@......
    450   | 20: 00 ff e0 00 00 0a 00 ff e1 00 00 09 00 00 03 00 \| ........á.......
    451   | 30: 00 06 9b fe 5b 56 96 49 1f 9f ca dd d5 ba b9 52 \| ..þ[V.I.\xd9 ...º¹R
    452   | 40: 6f 2d \|o-
    453   | ]
    454   | <-- [
    455   | 0: 16 03 00 03 e5 02 00 00 46 03 00 7f e5 0d 1b 1d \| ........F.......
    456   | 10: 68 7f 3a 79 60 d5 17 3c 1d 9c 96 b3 88 d2 69 3b \| h.:y`..<..³.Òi;
    457   | 20: 78 e2 4b 8b a6 52 12 4b 46 e8 c2 20 14 11 89 05 \| x.K.¦R.KFè. ...
    458   | 30: 4d 52 91 fd 93 e0 51 48 91 90 08 96 c1 b6 76 77 \| MR.ý..QH.....¶vw
    459   | 40: 2a f4 00 08 a1 06 61 a2 64 1f 2e 9b 00 03 00 0b \| \*ô..¡.a¢d......
    460   | 50: 00 02 c5 00 02 c2 00 02 bf 30 82 02 bb 30 82 02 \| ..Å......0...0..
    461   | 60: 24 a0 03 02 01 02 02 02 01 36 30 0d 06 09 2a 86 \| $ .......60...*.
    462   | 70: 48 86 f7 0d 01 01 04 05 00 30 77 31 0b 30 09 06 \| H.÷......0w1.0..
    463   | 80: 03 55 04 06 13 02 55 53 31 2c 30 2a 06 03 55 04 \| .U....US1,0*..U.
    464   | 90: 0a 13 23 4e 65 74 73 63 61 70 65 20 43 6f 6d 6d \| ..#Netscape Comm
    465   | a0: 75 6e 69 63 61 74 69 6f 6e 73 20 43 6f 72 70 6f \| unications Corpo
    466   | b0: 72 61 74 69 6f 6e 31 11 30 0f 06 03 55 04 0b 13 \| ration1.0...U...
    467   | c0: 08 48 61 72 64 63 6f 72 65 31 27 30 25 06 03 55 \| .Hardcore1'0%..U
    468   | d0: 04 03 13 1e 48 61 72 64 63 6f 72 65 20 43 65 72 \| ....Hardcore Cer
    469   | e0: 74 69 66 69 63 61 74 65 20 53 65 72 76 65 72 20 \| tificate Server
    470   | f0: 49 49 30 1e 17 0d 39 38 30 35 31 36 30 31 30 33 \| II0...9805160103
    471   | <additional data lines>
    472   | ]
    473   | <additional records in same format>
    474   | Server socket closed.
    475 
    476   Example 4
    477 
    478   | In this example, the -s option turns on SSL parsing, and the -h option
    479   | turns on hex/ASCII format. Both formats are shown for each record. The
    480   | output is routed to a text file.
    481 
    482   $ ssltap -hs -p 444 interzone.mcom.com:443 > hs.txt
    483 
    484   Output
    485 
    486   | Connected to interzone.mcom.com:443
    487   | --> [
    488   | 0: 80 3d 01 03 00 00 24 00 00 00 10 01 00 80 02 00 \| .=....$.........
    489   | 10: 80 03 00 80 04 00 80 06 00 40 07 00 c0 00 00 04 \| .........@......
    490   | 20: 00 ff e0 00 00 0a 00 ff e1 00 00 09 00 00 03 03 \| ........á.......
    491   | 30: 55 e6 e4 99 79 c7 d7 2c 86 78 96 5d b5 cf e9 \|U..yÇ\xb0 ,.x.]µÏé
    492   | alloclen = 63 bytes
    493   | [ssl2] ClientHelloV2 {
    494   | version = {0x03, 0x00}
    495   | cipher-specs-length = 36 (0x24)
    496   | sid-length = 0 (0x00)
    497   | challenge-length = 16 (0x10)
    498   | cipher-suites = {
    499   | (0x010080) SSL2/RSA/RC4-128/MD5
    500   | (0x020080) SSL2/RSA/RC4-40/MD5
    501   | (0x030080) SSL2/RSA/RC2CBC128/MD5
    502   | (0x040080) SSL2/RSA/RC2CBC40/MD5
    503   | (0x060040) SSL2/RSA/DES64CBC/MD5
    504   | (0x0700c0) SSL2/RSA/3DES192EDE-CBC/MD5
    505   | (0x000004) SSL3/RSA/RC4-128/MD5
    506   | (0x00ffe0) SSL3/RSA-FIPS/3DES192EDE-CBC/SHA
    507   | (0x00000a) SSL3/RSA/3DES192EDE-CBC/SHA
    508   | (0x00ffe1) SSL3/RSA-FIPS/DES64CBC/SHA
    509   | (0x000009) SSL3/RSA/DES64CBC/SHA
    510   | (0x000003) SSL3/RSA/RC4-40/MD5
    511   | }
    512   | session-id = { }
    513   | challenge = { 0x0355 0xe6e4 0x9979 0xc7d7 0x2c86 0x7896 0x5db
    514 
    515   | 0xcfe9 }
    516   | }
    517   | ]
    518   | <additional records in same formats>
    519   | Server socket closed.
    520 
    521   Usage Tips
    522 
    523   | When SSL restarts a previous session, it makes use of cached information
    524   | to do a partial handshake. If you wish to capture a full SSL handshake,
    525   | restart the browser to clear the session id cache.
    526 
    527   | If you run the tool on a machine other than the SSL server to which you
    528   | are trying to connect, the browser will complain that the host name you
    529   | are trying to connect to is different from the certificate. If you are
    530   | using the default BadCert callback, you can still connect through a
    531   | dialog. If you are not using the default BadCert callback, the one you
    532   | supply must allow for this possibility.
    533 
    534   See Also
    535 
    536   | The NSS Security Tools are also documented at
    537   | [1]\ `http://www.mozilla.org/projects/security/pki/nss/ <https://www.mozilla.org/projects/security/pki/nss/>`__.
    538 
    539   Additional Resources
    540 
    541   | NSS is maintained in conjunction with PKI and security-related projects
    542   | through Mozilla dn Fedora. The most closely-related project is Dogtag PKI,
    543   | with a project wiki at [2]\ http://pki.fedoraproject.org/wiki/.
    544 
    545   | For information specifically about NSS, the NSS project wiki is located at
    546   | [3]\ `http://www.mozilla.org/projects/security/pki/nss/ <https://www.mozilla.org/projects/security/pki/nss/>`__.
    547     The NSS site relates
    548   | directly to NSS code changes and releases.
    549 
    550   Mailing lists: pki-devel@redhat.com and pki-users@redhat.com
    551 
    552   IRC: Freenode at #dogtag-pki
    553 
    554   Authors
    555 
    556   | The NSS tools were written and maintained by developers with Netscape and
    557   | now with Red Hat and Sun.
    558 
    559   | Authors: Elio Maldonado <emaldona@redhat.com>, Deon Lackey
    560   | <dlackey@redhat.com>.
    561 
    562   Copyright
    563 
    564   (c) 2010, Red Hat, Inc. Licensed under the GNU Public License version 2.
    565 
    566   References
    567 
    568   | Visible links
    569   | 1.
    570     `http://www.mozilla.org/projects/secu.../pki/nss/tools <https://www.mozilla.org/projects/security/pki/nss/tools>`__
    571   | 2. http://pki.fedoraproject.org/wiki/
    572   | 3.
    573     `http://www.mozilla.org/projects/security/pki/nss/ <https://www.mozilla.org/projects/security/pki/nss/>`__