Skip to content

Commit

Permalink
replaced regular http import with zgrab2 http
Browse files Browse the repository at this point in the history
  • Loading branch information
RicYaben committed Jul 24, 2024
1 parent 2d225c8 commit d209322
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion modules/upnp/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (
"bytes"
"fmt"
"net"
"net/http"
"net/url"
"strings"
"time"

"github.com/zmap/zgrab2/lib/http"
"golang.org/x/exp/slices"
)

Expand Down
2 changes: 1 addition & 1 deletion modules/upnp/scanner.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package upnp

import (
"net/http"
"github.com/zmap/zgrab2/lib/http"

log "github.com/sirupsen/logrus"
"github.com/zmap/zgrab2"
Expand Down
8 changes: 4 additions & 4 deletions modules/upnp/upnp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (cfg *upnpTester) getScanner() (*Scanner, error) {
flags.St = "upnp:rootdevice"
flags.UserAgent = "Mozilla/5.0 UPnP zgrab/0.1.6"
flags.Port = uint(cfg.port)
flags.Timeout = 1 * time.Second
flags.Timeout = 10 * time.Second

scanner := module.NewScanner()
if err := scanner.Init(flags); err != nil {
Expand All @@ -65,10 +65,10 @@ func (cfg *upnpTester) runTest(t *testing.T, testName string) {
if err != nil {
t.Fatalf("[%s] Unexpected error: %v", testName, err)
}
cfg.runFakeUPnPServer(t)
//cfg.runFakeUPnPServer(t)

target := zgrab2.ScanTarget{
IP: net.ParseIP("127.0.0.1"),
IP: net.ParseIP("85.222.188.130"),
}
status, ret, err := scanner.Scan(target)
if status != cfg.expectedStatus {
Expand All @@ -86,7 +86,7 @@ func (cfg *upnpTester) runTest(t *testing.T, testName string) {

var tests = map[string]*upnpTester{
"success": {
port: 1901, // Very often the UPnP port 1900 is already binded
port: 1900, // Very often the UPnP port 1900 is already binded
expectedStatus: zgrab2.SCAN_SUCCESS,
},
}
Expand Down

0 comments on commit d209322

Please sign in to comment.