more lint driven refactoring

This commit is contained in:
evilsocket 2018-04-24 18:26:16 +02:00
commit 0de6f3a76e
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
57 changed files with 168 additions and 241 deletions

View file

@ -45,7 +45,7 @@ func Dot11Info(id layers.Dot11InformationElementID, info []byte) *layers.Dot11In
func NewDot11Beacon(conf Dot11ApConfig, seq uint16) (error, []byte) {
flags := openFlags
if conf.Encryption == true {
if conf.Encryption {
flags = wpaFlags
}
@ -70,7 +70,7 @@ func NewDot11Beacon(conf Dot11ApConfig, seq uint16) (error, []byte) {
Dot11Info(layers.Dot11InformationElementIDDSSet, []byte{byte(conf.Channel & 0xff)}),
}
if conf.Encryption == true {
if conf.Encryption {
stack = append(stack, &layers.Dot11InformationElement{
ID: layers.Dot11InformationElementIDRSNInfo,
Length: uint8(len(wpaRSN) & 0xff),
@ -125,7 +125,7 @@ func Dot11ParseIDSSID(packet gopacket.Packet) (bool, string) {
for _, layer := range packet.Layers() {
if layer.LayerType() == layers.LayerTypeDot11InformationElement {
dot11info, ok := layer.(*layers.Dot11InformationElement)
if ok == true && dot11info.ID == layers.Dot11InformationElementIDSSID {
if ok && dot11info.ID == layers.Dot11InformationElementIDSSID {
if len(dot11info.Info) == 0 {
return true, "<hidden>"
}
@ -152,7 +152,7 @@ func Dot11ParseEncryption(packet gopacket.Packet, dot11 *layers.Dot11) (bool, st
for _, layer := range packet.Layers() {
if layer.LayerType() == layers.LayerTypeDot11InformationElement {
info, ok := layer.(*layers.Dot11InformationElement)
if ok == true {
if ok {
found = true
if info.ID == layers.Dot11InformationElementIDRSNInfo {
enc = "WPA2"
@ -203,7 +203,7 @@ func Dot11ParseDSSet(packet gopacket.Packet) (bool, int) {
found := false
for _, layer := range packet.Layers() {
info, ok := layer.(*layers.Dot11InformationElement)
if ok == true {
if ok {
if info.ID == layers.Dot11InformationElementIDDSSet {
channel, _ = Dot11InformationElementIDDSSetDecode(info.Info)
found = true

View file

@ -99,7 +99,7 @@ func (s *NTLMState) AddClientResponse(seq uint32, value string, cb func(data NTL
s.Lock()
defer s.Unlock()
if chall, found := s.Responses[seq]; found == true {
if chall, found := s.Responses[seq]; found {
pair := NTLMChallengeResponse{
Challenge: chall,
Response: value,

View file

@ -65,7 +65,7 @@ func NewQueue(iface *network.Endpoint) (q *Queue, err error) {
pktCb: nil,
}
if q.active == true {
if q.active {
if q.handle, err = pcap.OpenLive(iface.Name(), 1024, true, pcap.BlockForever); err != nil {
return
}
@ -229,7 +229,7 @@ func (q *Queue) Stop() {
q.Lock()
defer q.Unlock()
if q.active == true {
if q.active {
// wait for write operations to be completed
q.writes.Wait()
// signal the main loop to exit and close the handle