<commit_before>package main

import (
	"bytes"
	"encoding/json"
	"flag"
	"fmt"
	"log"
	"net"
	"os"
	"os/exec"
	"runtime"
	"time"

	"math/rand"
	"modules/amqpmodule"

	"config"
)

const rxQueue = "scan_ready_queue"
const txQueue = "conn_scan_results_queue"

var workerCount int
var broker *amqpmodule.Broker
var cipherscan string

func failOnError(err error, msg string) {
	if err != nil {
		log.Fatalf("%s: %s", msg, err)
		panic(fmt.Sprintf("%s: %s", msg, err))
	}
}

func panicIf(err error) {
	if err != nil {
		log.Println(fmt.Sprintf("%s", err))
	}
}

func printIntro() {
	fmt.Println(`
	##################################
	#         TLSRetriever          #
	##################################
	`)
}

type ScanInfo struct {
	Target         string        `json:"target"`
	Timestamp      string        `json:"utctimestamp"`
	ServerSide     string        `json:"serverside"`
	CipherSuites   []Ciphersuite `json:"ciphersuite"`
	CurvesFallback string        `json:"curves_fallback"`
}

type Ciphersuite struct {
	Cipher       string   `json:"cipher"`
	Protocols    []string `json:"protocols"`
	PubKey       []string `json:"pubkey"`
	SigAlg       []string `json:"sigalg"`
	Trusted      string   `json:"trusted"`
	TicketHint   string   `json:"ticket_hint"`
	OCSPStapling string   `json:"ocsp_stapling"`
	PFS          string   `json:"pfs"`
	Curves       string   `json:"curves,omitempty"`
}

func worker(msg []byte) {

	domain := string(msg)
	ip := getRandomIP(domain)

	if ip == "" {
		log.Println("Could not resolve ip for: ", domain)
		return
	}

	cmd := cipherscan + " -j --curves -servername " + domain + " " + ip + ":443 "
	fmt.Println(cmd)
	comm := exec.Command("bash", "-c", cmd)
	var out bytes.Buffer
	var stderr bytes.Buffer
	comm.Stdout = &out
	comm.Stderr = &stderr
	err := comm.Run()
	if err != nil {
		log.Println(err)
	}<commit_msg>mistake left in ( curves is []string, not string )<commit_after>package main

import (
	"bytes"
	"encoding/json"
	"flag"
	"fmt"
	"log"
	"net"
	"os"
	"os/exec"
	"runtime"
	"time"

	"math/rand"
	"modules/amqpmodule"

	"config"
)

const rxQueue = "scan_ready_queue"
const txQueue = "conn_scan_results_queue"

var workerCount int
var broker *amqpmodule.Broker
var cipherscan string

func failOnError(err error, msg string) {
	if err != nil {
		log.Fatalf("%s: %s", msg, err)
		panic(fmt.Sprintf("%s: %s", msg, err))
	}
}

func panicIf(err error) {
	if err != nil {
		log.Println(fmt.Sprintf("%s", err))
	}
}

func printIntro() {
	fmt.Println(`
	##################################
	#         TLSRetriever          #
	##################################
	`)
}

type ScanInfo struct {
	Target         string        `json:"target"`
	Timestamp      string        `json:"utctimestamp"`
	ServerSide     string        `json:"serverside"`
	CipherSuites   []Ciphersuite `json:"ciphersuite"`
	CurvesFallback string        `json:"curves_fallback"`
}

type Ciphersuite struct {
	Cipher       string   `json:"cipher"`
	Protocols    []string `json:"protocols"`
	PubKey       []string `json:"pubkey"`
	SigAlg       []string `json:"sigalg"`
	Trusted      string   `json:"trusted"`
	TicketHint   string   `json:"ticket_hint"`
	OCSPStapling string   `json:"ocsp_stapling"`
	PFS          string   `json:"pfs"`
	Curves       []string `json:"curves,omitempty"`
}

func worker(msg []byte) {

	domain := string(msg)
	ip := getRandomIP(domain)

	if ip == "" {
		log.Println("Could not resolve ip for: ", domain)
		return
	}

	cmd := cipherscan + " -j --curves -servername " + domain + " " + ip + ":443 "
	fmt.Println(cmd)
	comm := exec.Command("bash", "-c", cmd)
	var out bytes.Buffer
	var stderr bytes.Buffer
	comm.Stdout = &out
	comm.Stderr = &stderr
	err := comm.Run()
	if err != nil {
		log.Println(err)
	}
{'fraction_non_alphanumeric': 0.1807681976900349, 'fraction_numerical': 0.0016116035455278, 'mean_word_length': 3.3811764705882354, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6253393', 'n_tokens_mistral': 1394, 'n_tokens_neox': 1355, 'n_words': 312}