Friday, July 15, 2016

Using openssl to test SSL connection

Install openssl


Connect to server


openssl s_client -connect youserver.com:443 -showcerts


CONNECTED(00000164)
depth=2 C = US, O = GeoTrust Inc., CN = GeoTrust Global CA
verify return:1
depth=1 C = US, O = GeoTrust Inc., CN = RapidSSL SHA256 CA
verify return:1
depth=0 CN = yourserver.com
verify return:1
---
Certificate chain
 0 s:/CN=yourserver.com
   i:/C=US/O=GeoTrust Inc./CN=RapidSSL SHA256 CA
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
 1 s:/C=US/O=GeoTrust Inc./CN=RapidSSL SHA256 CA
   i:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
---
Server certificate
subject=/CN=yourserver.com
issuer=/C=US/O=GeoTrust Inc./CN=RapidSSL SHA256 CA
---
No client certificate CA names sent
Peer signing digest: SHA1
Server Temp Key: ECDH, P-521, 521 bits
---
SSL handshake has read 3100 bytes and written 558 bytes
---
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES256-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : ECDHE-RSA-AES256-SHA384
    Session-ID: ED280000CF500FD12BFD3637345041B63883D2BE08BB1E94B6E5DDBD18AD0C7A
    Session-ID-ctx:
    Master-Key: E0DCBBE41656F4118954F91B9E9B63BEF98576173C5BC48DF8B62446F0357700FC86C1BA6157EC7BCFCF
20EB485897B5
    Key-Arg   : None
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1468613406
    Timeout   : 300 (sec)
    Verify return code: 0 (ok)

Send HTTP commands

GET / HTTP/1.1
Host: youserver.com

Troubleshooting dlls

Confirming that dll exports a function


Open VS Command Prompt and run

dumpbin /exports yourDLL.dll


Microsoft (R) COFF/PE Dumper Version 11.00.61030.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file InnoSetupX2OUtils_d.dll

File Type: DLL

  Section contains the following exports for InnoSetupX2OUtils_d.dll

    00000000 characteristics
    5789203F time date stamp Fri Jul 15 13:41:19 2016
        0.00 version
           1 ordinal base
          38 number of functions
          38 number of names

    ordinal hint RVA      name

          1    0 0004B98D FWAddRule = @ILT+2440(_FWAddRule@36)
          2    1 0004C040 FWEnableRule = @ILT+4155(_FWEnableRule@4)
          3    2 0004B0FF FileSetFullControlForSID = @ILT+250(_FileSetFullControlForSID@8)
          4    3 0004C13A GUIDGenerateNew = @ILT+4405(_GUIDGenerateNew@8)
          5    4 0004BAFA GUIDIsCorrect = @ILT+2805(_GUIDIsCorrect@4)
          6    5 0004D0D0 GUIDispatchWaitingMessages = @ILT+8395(_GUIDispatchWaitingMessages@4)
          7    6 0004D1C5 GetLastX2OErrorMessage = @ILT+8640(_GetLastX2OErrorMessage@8)
          8    7 0004B67C IISAppPoolIdentityTypeFromString = @ILT+1655(_IISAppPoolIdentityTypeFromSt
ring@4)
          9    8 0004CAE5 IISAppPoolManagedPipelineModeFromString = @ILT+6880(_IISAppPoolManagedPipe
lineModeFromString@4)
         10    9 0004D76A IISFindApplicationPool = @ILT+10085(_IISFindApplicationPool@4)
         11    A 0004BF28 IISGetWebSiteId = @ILT+3875(_IISGetWebSiteId@8)
         12    B 0004B640 IISSetApplicationPool = @ILT+1595(_IISSetApplicationPool@36)
         13    C 0004D7A6 IISSetVirtualDirectory = @ILT+10145(_IISSetVirtualDirectory@24)
         14    D 0004BAA0 JSONtoVBADictionaryFromFile = @ILT+2715(_JSONtoVBADictionaryFromFile@8)
         15    E 0004C568 ProcessKillTreeByName = @ILT+5475(_ProcessKillTreeByName@8)
         16    F 0004CAF4 Reboot = @ILT+6895(_Reboot@0)
         17   10 0004C0A9 SecurityAccountNameFromSid = @ILT+4260(_SecurityAccountNameFromSid@20)
         18   11 0004B721 ServiceStopDependencies = @ILT+1820(_ServiceStopDependencies@4)
         19   12 0004C7F2 XMLChildElementAdd = @ILT+6125(_XMLChildElementAdd@12)
         20   13 0004CFBD XMLChildElementAddAsFirst = @ILT+8120(_XMLChildElementAddAsFirst@12)
         21   14 0004D3D7 XMLChildElementAddWithNamespace = @ILT+9170(_XMLChildElementAddWithNamespa
ce@16)
         22   15 0004C8F1 XMLCreateDocument = @ILT+6380(_XMLCreateDocument@4)
         23   16 0004BD16 XMLDocSetProperty = @ILT+3345(_XMLDocSetProperty@12)
         24   17 0004D440 XMLElementAdd = @ILT+9275(_XMLElementAdd@16)
         25   18 0004BCC1 XMLElementAddBefore = @ILT+3260(_XMLElementAddBefore@20)
         26   19 0004C32E XMLLoadDocument = @ILT+4905(_XMLLoadDocument@8)
         27   1A 0004D102 XMLNodeExists = @ILT+8445(_XMLNodeExists@12)
         28   1B 0004B9B0 XMLNodeFindChild = @ILT+2475(_XMLNodeFindChild@12)
         29   1C 0004C1DF XMLNodeGetAttribute = @ILT+4570(_XMLNodeGetAttribute@16)
         30   1D 0004D6A7 XMLNodeGetText = @ILT+9890(_XMLNodeGetText@12)
         31   1E 0004B429 XMLNodeMove = @ILT+1060(_XMLNodeMove@8)
         32   1F 0004CE78 XMLNodeRemove = @ILT+7795(_XMLNodeRemove@8)
         33   20 0004BCDF XMLNodeRemoveWithXPath = @ILT+3290(_XMLNodeRemoveWithXPath@8)
         34   21 0004B8FC XMLNodeReplaceWithXPath = @ILT+2295(_XMLNodeReplaceWithXPath@12)
         35   22 0004D373 XMLNodeSetAttribute = @ILT+9070(_XMLNodeSetAttribute@12)
         36   23 0004CBE4 XMLNodeSetText = @ILT+7135(_XMLNodeSetText@8)
         37   24 0004C978 XMLRelease = @ILT+6515(_XMLRelease@4)
         38   25 0004CB53 XMLSaveDocument = @ILT+6990(_XMLSaveDocument@8)

  Summary

        5000 .data
        2000 .idata
       22000 .rdata
        7000 .reloc
        1000 .rsrc
       9B000 .text
       4A000 .textbss


Depencency Walker



Dependency Walker is a free utility that scans any 32-bit or 64-bit Windows module (exe, dll, ocx, sys, etc.) and builds a hierarchical tree diagram of all dependent modules. For each module found, it lists all the functions that are exported by that module, and which of those functions are actually being called by other modules. Another view displays the minimum set of required files, along with detailed information about each file including a full path to the file, base address, version numbers, machine type, debug information, and more.
Dependency Walker is also very useful for troubleshooting system errors related to loading and executing modules. Dependency Walker detects many common application problems such as missing modules, invalid modules, import/export mismatches, circular dependency errors, mismatched machine types of modules, and module initialization failures.
Dependency Walker runs on Windows 95, 98, Me, NT, 2000, XP, 2003, Vista, 7, and 8. It can process any 32-bit or 64-bit Windows module, including ones designed for Windows CE. It can be run as graphical application or as a console application. Dependency Walker handles all types of module dependencies, including implicit, explicit (dynamic / runtime), forwarded, delay-loaded, and injected. A detailed help is included.



Thursday, July 14, 2016

Useful tools not related to development

Disk management

WinDirStat is a disk usage statistics viewer and cleanup tool for various versions of Microsoft Windows.