| 1 | package wifiscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/wifi`/ |
| 2 | |
| 3 | import ( |
| 4 | "bytesscip-go gomod github.com/golang/go/src go1.16 bytes/" |
| 5 | "fmtscip-go gomod github.com/golang/go/src go1.16 fmt/" |
| 6 | "github.com/bettercap/bettercap/networkscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/" |
| 7 | "netscip-go gomod github.com/golang/go/src go1.16 net/" |
| 8 | "pathscip-go gomod github.com/golang/go/src go1.16 path/" |
| 9 | |
| 10 | "github.com/bettercap/bettercap/packetsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/" |
| 11 | |
| 12 | "github.com/google/gopacketscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket`/" |
| 13 | "github.com/google/gopacket/layersscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/" |
| 14 | ) |
| 15 | |
| 16 | func allZerosscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/wifi`/allZeros().(s []byte) bool { |
| 17 | for _, v := range s { |
| 18 | if v != 0 { |
| 19 | return false |
| 20 | } |
| 21 | } |
| 22 | return true |
| 23 | } |
| 24 | |
| 25 | func (mod *WiFiModulescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/wifi`/WiFiModule#) discoverHandshakesscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/wifi`/WiFiModule#discoverHandshakes().(radiotap *layersscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/.RadioTapscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/RadioTap#, dot11 *layersscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/.Dot11scip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/Dot11#, packet gopacketscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket`/.Packetscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket`/Packet#) { |
| 26 | isEAPOL := false |
| 27 | |
| 28 | if ok, key, apMac, staMac := packetsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/.Dot11ParseEAPOLscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/packets`/Dot11ParseEAPOL().(packet, dot11); ok { |
| 29 | isEAPOL = true |
| 30 | |
| 31 | // first, locate the AP in our list by its BSSID |
| 32 | ap, found := mod.Sessionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/SessionModule#Session..WiFiscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Session#WiFi..Getscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/WiFi#Get().(apMac.Stringscip-go gomod github.com/golang/go/src go1.16 net/HardwareAddr#String().()) |
| 33 | if !found { |
| 34 | mod.Warningscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/SessionModule#Warning().("could not find AP with BSSID %s", apMac.Stringscip-go gomod github.com/golang/go/src go1.16 net/HardwareAddr#String().()) |
| 35 | return |
| 36 | } |
| 37 | |
| 38 | // locate the client station, if its BSSID is ours, it means we sent |
| 39 | // an association request via wifi.assoc because we're trying to capture |
| 40 | // the PMKID from the first EAPOL sent by the AP. |
| 41 | // (Reference about PMKID https://hashcat.net/forum/thread-7717.html) |
| 42 | // In this case, we need to add ourselves as a client station of the AP |
| 43 | // in order to have a consistent association of AP, client and handshakes. |
| 44 | staIsUs := bytesscip-go gomod github.com/golang/go/src go1.16 bytes/.Equalscip-go gomod github.com/golang/go/src go1.16 bytes/Equal().(staMac, mod.ifacescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/wifi`/WiFiModule#iface..HWscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Endpoint#HW.) |
| 45 | station, found := ap.Getscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/AccessPoint#Get().(staMac.Stringscip-go gomod github.com/golang/go/src go1.16 net/HardwareAddr#String().()) |
| 46 | staAdded := false |
| 47 | if !found { |
| 48 | station, staAdded = ap.AddClientIfNewscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/AccessPoint#AddClientIfNew().(staMac.Stringscip-go gomod github.com/golang/go/src go1.16 net/HardwareAddr#String().(), ap.Frequencyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Station#Frequency., ap.RSSIscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Station#RSSI.) |
| 49 | } |
| 50 | |
| 51 | rawPMKID := []byte(nil) |
| 52 | if !key.Installscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/EAPOLKey#Install. && key.KeyACKscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/EAPOLKey#KeyACK. && !key.KeyMICscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/EAPOLKey#KeyMIC. { |
| 53 | // [1] (ACK) AP is sending ANonce to the client |
| 54 | rawPMKID = station.Handshakescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Station#Handshake..AddAndGetPMKIDscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Handshake#AddAndGetPMKID().(packet) |
| 55 | PMKID := "without PMKID" |
| 56 | if rawPMKID != nil { |
| 57 | PMKID = "with PMKID" |
| 58 | } |
| 59 | |
| 60 | mod.Debugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/SessionModule#Debug().("got frame 1/4 of the %s <-> %s handshake (%s) (anonce:%x)", |
| 61 | apMac, |
| 62 | staMac, |
| 63 | PMKID, |
| 64 | key.Noncescip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/EAPOLKey#Nonce.) |
| 65 | |
| 66 | //add the ap's station's beacon packet to be saved as part of the handshake cap file |
| 67 | //https://github.com/ZerBea/hcxtools/issues/92 |
| 68 | //https://github.com/bettercap/bettercap/issues/592 |
| 69 | |
| 70 | if ap.Stationscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/AccessPoint#Station..Handshakescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Station#Handshake..Beaconscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Handshake#Beacon. != nil { |
| 71 | mod.Debugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/SessionModule#Debug().("adding beacon frame to handshake for %s", apMac) |
| 72 | station.Handshakescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Station#Handshake..AddFramescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Handshake#AddFrame().(1, ap.Stationscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/AccessPoint#Station..Handshakescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Station#Handshake..Beaconscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Handshake#Beacon.) |
| 73 | } |
| 74 | |
| 75 | } else if !key.Installscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/EAPOLKey#Install. && !key.KeyACKscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/EAPOLKey#KeyACK. && key.KeyMICscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/EAPOLKey#KeyMIC. && !allZerosscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/wifi`/allZeros().(key.Noncescip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/EAPOLKey#Nonce.) { |
| 76 | // [2] (MIC) client is sending SNonce+MIC to the API |
| 77 | station.Handshakescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Station#Handshake..AddFramescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Handshake#AddFrame().(1, packet) |
| 78 | |
| 79 | mod.Debugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/SessionModule#Debug().("got frame 2/4 of the %s <-> %s handshake (snonce:%x mic:%x)", |
| 80 | apMac, |
| 81 | staMac, |
| 82 | key.Noncescip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/EAPOLKey#Nonce., |
| 83 | key.MICscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/EAPOLKey#MIC.) |
| 84 | } else if key.Installscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/EAPOLKey#Install. && key.KeyACKscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/EAPOLKey#KeyACK. && key.KeyMICscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/EAPOLKey#KeyMIC. { |
| 85 | // [3]: (INSTALL+ACK+MIC) AP informs the client that the PTK is installed |
| 86 | station.Handshakescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Station#Handshake..AddFramescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Handshake#AddFrame().(2, packet) |
| 87 | |
| 88 | mod.Debugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/SessionModule#Debug().("got frame 3/4 of the %s <-> %s handshake (mic:%x)", |
| 89 | apMac, |
| 90 | staMac, |
| 91 | key.MICscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/EAPOLKey#MIC.) |
| 92 | } |
| 93 | |
| 94 | // if we have unsaved packets as part of the handshake, save them. |
| 95 | numUnsaved := station.Handshakescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Station#Handshake..NumUnsavedscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Handshake#NumUnsaved().() |
| 96 | shakesFileName := mod.shakesFilescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/wifi`/WiFiModule#shakesFile. |
| 97 | if mod.shakesAggregatescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/wifi`/WiFiModule#shakesAggregate. == false { |
| 98 | shakesFileName = pathscip-go gomod github.com/golang/go/src go1.16 path/.Joinscip-go gomod github.com/golang/go/src go1.16 path/Join().(shakesFileName, fmtscip-go gomod github.com/golang/go/src go1.16 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.16 fmt/Sprintf().("%s.pcap", ap.PathFriendlyNamescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Station#PathFriendlyName().())) |
| 99 | } |
| 100 | doSave := numUnsaved > 0 |
| 101 | if doSave && shakesFileName != "" { |
| 102 | mod.Debugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/SessionModule#Debug().("(aggregate %v) saving handshake frames to %s", mod.shakesAggregatescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/wifi`/WiFiModule#shakesAggregate., shakesFileName) |
| 103 | if err := mod.Sessionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/SessionModule#Session..WiFiscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Session#WiFi..SaveHandshakesToscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/WiFi#SaveHandshakesTo().(shakesFileName, mod.handlescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/wifi`/WiFiModule#handle..LinkTypescip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/pcap`/Handle#LinkType().()); err != nil { |
| 104 | mod.Errorscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/SessionModule#Error().("error while saving handshake frames to %s: %s", shakesFileName, err) |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | validPMKID := rawPMKID != nil |
| 109 | validHalfHandshake := !staIsUs && station.Handshakescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Station#Handshake..Halfscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Handshake#Half().() |
| 110 | validFullHandshake := station.Handshakescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Station#Handshake..Completescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Handshake#Complete().() |
| 111 | // if we have unsaved packets AND |
| 112 | // if we captured a PMKID OR |
| 113 | // if we captured am half handshake which is not ours OR |
| 114 | // if we captured a full handshake |
| 115 | if doSave && (validPMKID || validHalfHandshake || validFullHandshake) { |
| 116 | mod.Sessionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/SessionModule#Session..Eventsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Session#Events..Addscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#Add().("wifi.client.handshake", HandshakeEventscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/wifi`/HandshakeEvent#{ |
| 117 | Filescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/wifi`/HandshakeEvent#File.: shakesFileName, |
| 118 | NewPacketsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/wifi`/HandshakeEvent#NewPackets.: numUnsaved, |
| 119 | APscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/wifi`/HandshakeEvent#AP.: apMac.Stringscip-go gomod github.com/golang/go/src go1.16 net/HardwareAddr#String().(), |
| 120 | Stationscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/wifi`/HandshakeEvent#Station.: staMac.Stringscip-go gomod github.com/golang/go/src go1.16 net/HardwareAddr#String().(), |
| 121 | PMKIDscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/wifi`/HandshakeEvent#PMKID.: rawPMKID, |
| 122 | Halfscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/wifi`/HandshakeEvent#Half.: station.Handshakescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Station#Handshake..Halfscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Handshake#Half().(), |
| 123 | Fullscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/wifi`/HandshakeEvent#Full.: station.Handshakescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Station#Handshake..Completescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Handshake#Complete().(), |
| 124 | }) |
| 125 | // make sure the info that we have key material for this AP |
| 126 | // is persisted even after stations are pruned due to inactivity |
| 127 | ap.WithKeyMaterialscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/AccessPoint#WithKeyMaterial().(true) |
| 128 | } |
| 129 | // if we added ourselves as a client station but we didn't get any |
| 130 | // PMKID, just remove it from the list of clients of this AP. |
| 131 | if staAdded || (staIsUs && rawPMKID == nil) { |
| 132 | ap.RemoveClientscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/AccessPoint#RemoveClient().(staMac.Stringscip-go gomod github.com/golang/go/src go1.16 net/HardwareAddr#String().()) |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | // quick and dirty heuristic, see thread here https://github.com/bettercap/bettercap/issues/810#issuecomment-805145392 |
| 137 | if isEAPOL || (dot11.Typescip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/Dot11#Type..MainTypescip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/Dot11Type#MainType().() != layersscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/.Dot11TypeDatascip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/Dot11TypeData. && dot11.Typescip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/Dot11#Type..MainTypescip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/Dot11Type#MainType().() != layersscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/.Dot11TypeCtrlscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/Dot11TypeCtrl.) { |
| 138 | target := (* networkscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/.Stationscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Station#)(nil) |
| 139 | targetAP := (* networkscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/.AccessPointscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/AccessPoint#)(nil) |
| 140 | |
| 141 | // collect target bssids |
| 142 | bssids := make([]netscip-go gomod github.com/golang/go/src go1.16 net/.HardwareAddrscip-go gomod github.com/golang/go/src go1.16 net/HardwareAddr#, 0) |
| 143 | for _, addr := range []netscip-go gomod github.com/golang/go/src go1.16 net/.HardwareAddrscip-go gomod github.com/golang/go/src go1.16 net/HardwareAddr#{dot11.Address1scip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/Dot11#Address1., dot11.Address2scip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/Dot11#Address2., dot11.Address3scip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/Dot11#Address3., dot11.Address4scip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/Dot11#Address4.} { |
| 144 | if bytesscip-go gomod github.com/golang/go/src go1.16 bytes/.Equalscip-go gomod github.com/golang/go/src go1.16 bytes/Equal().(addr, networkscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/.BroadcastHwscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/BroadcastHw.) == false { |
| 145 | bssids = append(bssids, addr) |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | // for each AP |
| 150 | mod.Sessionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/SessionModule#Session..WiFiscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Session#WiFi..EachAccessPointscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/WiFi#EachAccessPoint().(func(mac string, ap *networkscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/.AccessPointscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/AccessPoint#) { |
| 151 | // only check APs we captured handshakes of |
| 152 | if target == nil && ap.HasKeyMaterialscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/AccessPoint#HasKeyMaterial().() { |
| 153 | // search client station |
| 154 | ap.EachClientscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/AccessPoint#EachClient().(func(mac string, station *networkscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/.Stationscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Station#) { |
| 155 | // any valid key material for this station? |
| 156 | if station.Handshakescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Station#Handshake..Anyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Handshake#Any().() { |
| 157 | // check if target |
| 158 | for _, a := range bssids { |
| 159 | if bytesscip-go gomod github.com/golang/go/src go1.16 bytes/.Equalscip-go gomod github.com/golang/go/src go1.16 bytes/Equal().(a, station.HWscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Endpoint#HW.) { |
| 160 | target = station |
| 161 | targetAP = ap |
| 162 | break |
| 163 | } |
| 164 | } |
| 165 | } |
| 166 | }) |
| 167 | } |
| 168 | }) |
| 169 | |
| 170 | if target != nil { |
| 171 | mod.Debugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/SessionModule#Debug().("saving extra %s frame (%d bytes) for %s", |
| 172 | dot11.Typescip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/Dot11#Type..Stringscip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/layers`/Dot11Type#String().(), |
| 173 | len(packet.Datascip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket`/Packet#Data().()), |
| 174 | target.Stringscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Endpoint#String().()) |
| 175 | |
| 176 | target.Handshakescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Station#Handshake..AddExtrascip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Handshake#AddExtra().(packet) |
| 177 | |
| 178 | shakesFileName := mod.shakesFilescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/wifi`/WiFiModule#shakesFile. |
| 179 | if mod.shakesAggregatescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/wifi`/WiFiModule#shakesAggregate. == false { |
| 180 | shakesFileName = pathscip-go gomod github.com/golang/go/src go1.16 path/.Joinscip-go gomod github.com/golang/go/src go1.16 path/Join().(shakesFileName, fmtscip-go gomod github.com/golang/go/src go1.16 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.16 fmt/Sprintf().("%s.pcap", targetAP.PathFriendlyNamescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Station#PathFriendlyName().())) |
| 181 | } |
| 182 | if shakesFileName != "" { |
| 183 | mod.Debugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/SessionModule#Debug().("(aggregate %v) saving handshake frames to %s", mod.shakesAggregatescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/wifi`/WiFiModule#shakesAggregate., shakesFileName) |
| 184 | if err := mod.Sessionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/SessionModule#Session..WiFiscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Session#WiFi..SaveHandshakesToscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/WiFi#SaveHandshakesTo().(shakesFileName, mod.handlescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/wifi`/WiFiModule#handle..LinkTypescip-go gomod github.com/google/gopacket v1.1.19 `github.com/google/gopacket/pcap`/Handle#LinkType().()); err != nil { |
| 185 | mod.Errorscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/SessionModule#Error().("error while saving handshake frames to %s: %s", shakesFileName, err) |
| 186 | } |
| 187 | } |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | } |