forked from s-rah/onionscan
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds support for scanning tls endpoints (:443) and extracts all the certificate data to report for further analysis
- Loading branch information
Showing
6 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package protocol | ||
|
||
import ( | ||
"crypto/tls" | ||
"fmt" | ||
"github.com/s-rah/onionscan/config" | ||
"github.com/s-rah/onionscan/report" | ||
"github.com/s-rah/onionscan/utils" | ||
) | ||
|
||
type TLSProtocolScanner struct { | ||
} | ||
|
||
func (sps *TLSProtocolScanner) ScanProtocol(hiddenService string, osc *config.OnionscanConfig, report *report.OnionScanReport) { | ||
osc.LogInfo(fmt.Sprintf("Checking %s TLS(443)\n", hiddenService)) | ||
conn, err := utils.GetNetworkConnection(hiddenService, 443, osc.TorProxyAddress, osc.Timeout) | ||
if err != nil { | ||
osc.LogInfo("Failed to connect to service on port 443\n") | ||
report.TLSDetected = false | ||
} else { | ||
osc.LogInfo("Found TLS Endpoint\n") | ||
report.TLSDetected = true | ||
config := &tls.Config{ | ||
InsecureSkipVerify:true, | ||
} | ||
tlsConn := tls.Client(conn, config) | ||
tlsConn.Write([]byte("GET / HTTP/1.1\r\n\r\n")) | ||
for _, certificate := range tlsConn.ConnectionState().PeerCertificates { | ||
osc.LogInfo(fmt.Sprintf("Found Certificate %v \n", certificate)) | ||
report.Certificates = append(report.Certificates, *certificate) | ||
} | ||
tlsConn.Close() | ||
} | ||
conn.Close() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters