-
-
Save jakewarren/61c7139c9377c72e16bc446a0c5de818 to your computer and use it in GitHub Desktop.
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
package main | |
import ( | |
"crypto/tls" | |
"fmt" | |
"log" | |
"net" | |
"os" | |
"strings" | |
"time" | |
) | |
var Target = "" | |
func main() { | |
if len(os.Args) != 2 { | |
fmt.Println("usage: ticketbleed [domain:port]") | |
os.Exit(1) | |
} | |
Target := os.Args[1] | |
conf := &tls.Config{ | |
InsecureSkipVerify: true, | |
ClientSessionCache: tls.NewLRUClientSessionCache(32), | |
} | |
dialer := &net.Dialer{ | |
Timeout: 30 * time.Second, | |
} | |
conn, err := tls.DialWithDialer(dialer, "tcp", Target, conf) | |
if err == nil { | |
conn.Close() | |
} else if strings.Contains(err.Error(), "timeout") { | |
fmt.Println(Target, "connection timed out") | |
os.Exit(2) | |
} else { | |
log.Fatalf("Error testing %s: %s", Target, err) | |
} | |
conn, err = tls.Dial("tcp", Target, conf) | |
if err != nil && strings.Contains(err.Error(), "unexpected message") { | |
fmt.Println(Target, "is vulnerable to Ticketbleed") | |
} else if err != nil { | |
log.Fatalln("Failed to reconnect:", err) | |
} else { | |
fmt.Println(Target, "does NOT appear to be vulnerable") | |
conn.Close() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment