Skip to content

Commit bdab66e

Browse files
author
Your Name
committed
update print fp
1 parent 1c64db2 commit bdab66e

File tree

7 files changed

+788
-81
lines changed

7 files changed

+788
-81
lines changed

cmd/main.go

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ func main() {
5353
versionFlag := flag.Bool("version", false, "Show version information")
5454
outputFormat := flag.String("output", "", "Output format: json, html, or md")
5555
portList := flag.String("port", "", "Custom ports to scan (comma-separated, e.g., '80,443,8080')")
56-
reportURL := flag.String("report-url", "", "URL to report scan results")
56+
reportURL := flag.String("report", "", "URL to report scan results")
57+
apiKey := flag.String("apikey", "", "API key for report authentication (Bearer token)")
5758
flag.Parse()
5859

5960
if *versionFlag {
@@ -132,7 +133,7 @@ func main() {
132133
}
133134

134135
if *reportURL != "" {
135-
if err := reportResults(results, *reportURL); err != nil {
136+
if err := reportResults(results, *reportURL, *apiKey); err != nil {
136137
log.Printf("Error reporting results for target %s: %v", target, err)
137138
} else {
138139
log.Printf("Successfully reported results for target %s", target)
@@ -237,7 +238,7 @@ func jsonToMarkdown(jsonData []byte, filename string) error {
237238
return os.WriteFile(filename, []byte(md.String()), 0644)
238239
}
239240

240-
func reportResults(results []stage.Node, reportURL string) error {
241+
func reportResults(results []stage.Node, reportURL string, apiKey string) error {
241242
if reportURL == "" {
242243
return nil
243244
}
@@ -247,7 +248,17 @@ func reportResults(results []stage.Node, reportURL string) error {
247248
return fmt.Errorf("failed to marshal results for reporting: %v", err)
248249
}
249250

250-
resp, err := http.Post(reportURL, "application/json", bytes.NewBuffer(jsonData))
251+
req, err := http.NewRequest("POST", reportURL, bytes.NewBuffer(jsonData))
252+
if err != nil {
253+
return fmt.Errorf("failed to create request: %v", err)
254+
}
255+
req.Header.Set("Content-Type", "application/json")
256+
if apiKey != "" {
257+
req.Header.Set("Authorization", "Bearer "+apiKey)
258+
}
259+
260+
client := &http.Client{Timeout: 30 * time.Second}
261+
resp, err := client.Do(req)
251262
if err != nil {
252263
return fmt.Errorf("failed to send report: %v", err)
253264
}
@@ -270,6 +281,9 @@ func runListenMode() {
270281
target := listenCmd.String("target", "", "Target for active scan (supports ; or , as separator)")
271282
output := listenCmd.String("output", "", "Output file path (JSON format)")
272283
reportURL := listenCmd.String("report", "", "Report URL for asset reporting")
284+
apiKey := listenCmd.String("apikey", "", "API key for report authentication (Bearer token)")
285+
reportInterval := listenCmd.Duration("report-interval", 10*time.Minute, "Minimum interval between reports for same IP (default 10m)")
286+
cacheDir := listenCmd.String("cache-dir", ".zscan_cache", "Cache directory for passive discovery")
273287
configPath := listenCmd.String("config", "config/config.yaml", "Path to config file")
274288
help := listenCmd.Bool("help", false, "Show help for listen command")
275289
helpShort := listenCmd.Bool("h", false, "Show help for listen command")
@@ -314,6 +328,9 @@ func runListenMode() {
314328
Targets: targets,
315329
OutputPath: *output,
316330
ReportURL: *reportURL,
331+
APIKey: *apiKey,
332+
ReportInterval: *reportInterval,
333+
CacheDir: *cacheDir,
317334
ConfigPath: *configPath,
318335
TemplatesDir: "templates",
319336
}
@@ -330,6 +347,9 @@ func runListenMode() {
330347
}
331348
if config.ReportURL != "" {
332349
fmt.Printf("Report URL: %s\n", config.ReportURL)
350+
if config.APIKey != "" {
351+
fmt.Println("API Key: ********")
352+
}
333353
}
334354
fmt.Println("Press Ctrl+C to stop...")
335355
fmt.Println()

pkg/stage/assets/fingerprints.json

Lines changed: 209 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,47 +1754,249 @@
17541754
},
17551755
"hp-printer": {
17561756
"headers": [
1757-
"Server: HP HTTP Server"
1757+
"Server: HP HTTP Server",
1758+
"Server: HP-ChaiSOE",
1759+
"Server: Virata-EmWeb"
17581760
],
17591761
"body": [
17601762
"HP LaserJet",
1761-
"HP Color",
1762-
"Hewlett-Packard"
1763+
"HP Color LaserJet",
1764+
"HP OfficeJet",
1765+
"HP DeskJet",
1766+
"HP ENVY",
1767+
"HP PageWide",
1768+
"HP Designjet",
1769+
"Hewlett-Packard",
1770+
"HP Embedded Web Server",
1771+
"hplogo\\.gif",
1772+
"/hp/device/this\\.LCDispatcher"
17631773
],
17641774
"vendor": "hp",
17651775
"devicetype": "printer"
17661776
},
17671777
"canon-printer": {
1778+
"headers": [
1779+
"Server: KS_HTTP",
1780+
"Server: CANON HTTP Server"
1781+
],
17681782
"body": [
17691783
"Canon",
1770-
"imageRUNNER"
1784+
"imageRUNNER",
1785+
"imageCLASS",
1786+
"imagePRESS",
1787+
"imagePROGRAF",
1788+
"PIXMA",
1789+
"MAXIFY",
1790+
"Canon Inc\\.",
1791+
"Remote UI",
1792+
"/rui/"
17711793
],
17721794
"vendor": "canon",
17731795
"devicetype": "printer"
17741796
},
17751797
"epson-printer": {
1798+
"headers": [
1799+
"Server: EPSON_Linux",
1800+
"Server: EPSON HTTP Server"
1801+
],
17761802
"body": [
17771803
"EPSON",
1778-
"Epson"
1804+
"Epson",
1805+
"WorkForce",
1806+
"EcoTank",
1807+
"Expression",
1808+
"Stylus",
1809+
"EPSON Web Config",
1810+
"Seiko Epson"
17791811
],
17801812
"vendor": "epson",
17811813
"devicetype": "printer"
17821814
},
1815+
"brother-printer": {
1816+
"headers": [
1817+
"Server: debut"
1818+
],
1819+
"body": [
1820+
"Brother Industries",
1821+
"Brother HL-",
1822+
"Brother MFC-",
1823+
"Brother DCP-",
1824+
"/general/status\\.html"
1825+
],
1826+
"vendor": "brother",
1827+
"devicetype": "printer"
1828+
},
17831829
"kyocera-printer": {
1830+
"headers": [
1831+
"Server: KYOCERA"
1832+
],
17841833
"body": [
17851834
"KYOCERA",
1786-
"Kyocera"
1835+
"Kyocera",
1836+
"TASKalfa",
1837+
"ECOSYS",
1838+
"Kyocera Document Solutions"
17871839
],
17881840
"vendor": "kyocera",
17891841
"devicetype": "printer"
17901842
},
1843+
"xerox-printer": {
1844+
"headers": [
1845+
"Server: Allegra-Software",
1846+
"Server: Apache.*Xerox"
1847+
],
1848+
"body": [
1849+
"Xerox Corporation",
1850+
"WorkCentre",
1851+
"Phaser",
1852+
"VersaLink",
1853+
"AltaLink",
1854+
"ColorQube",
1855+
"/dyn/status\\.xml"
1856+
],
1857+
"vendor": "xerox",
1858+
"devicetype": "printer"
1859+
},
1860+
"konica-printer": {
1861+
"headers": [
1862+
"Server: Apache.*KONICA MINOLTA"
1863+
],
1864+
"body": [
1865+
"KONICA MINOLTA",
1866+
"Konica Minolta",
1867+
"bizhub",
1868+
"AccurioPress",
1869+
"AccurioPrint",
1870+
"/wcd/top\\.xml"
1871+
],
1872+
"vendor": "konica",
1873+
"devicetype": "printer"
1874+
},
1875+
"ricoh-printer": {
1876+
"headers": [
1877+
"Server: Web-Server"
1878+
],
1879+
"body": [
1880+
"RICOH",
1881+
"Ricoh",
1882+
"Aficio",
1883+
"imagio",
1884+
"MP C",
1885+
"/web/guest/en/websys/webArch/mainFrame\\.cgi"
1886+
],
1887+
"vendor": "ricoh",
1888+
"devicetype": "printer"
1889+
},
1890+
"sharp-printer": {
1891+
"body": [
1892+
"SHARP",
1893+
"Sharp Corporation",
1894+
"SHARP MX-",
1895+
"SHARP BP-",
1896+
"/mfp_top\\.html"
1897+
],
1898+
"vendor": "sharp",
1899+
"devicetype": "printer"
1900+
},
1901+
"toshiba-printer": {
1902+
"body": [
1903+
"TOSHIBA",
1904+
"e-STUDIO",
1905+
"TopAccess"
1906+
],
1907+
"vendor": "toshiba",
1908+
"devicetype": "printer"
1909+
},
1910+
"lexmark-printer": {
1911+
"headers": [
1912+
"Server: Lexmark"
1913+
],
1914+
"body": [
1915+
"Lexmark",
1916+
"Lexmark International"
1917+
],
1918+
"vendor": "lexmark",
1919+
"devicetype": "printer"
1920+
},
1921+
"samsung-printer": {
1922+
"headers": [
1923+
"Server: Samsung"
1924+
],
1925+
"body": [
1926+
"Samsung Electronics",
1927+
"SyncThru Web Service"
1928+
],
1929+
"vendor": "samsung",
1930+
"devicetype": "printer"
1931+
},
1932+
"oki-printer": {
1933+
"body": [
1934+
"OKI Data",
1935+
"OKI Electric Industry"
1936+
],
1937+
"vendor": "oki",
1938+
"devicetype": "printer"
1939+
},
1940+
"fuji-printer": {
1941+
"headers": [
1942+
"Server: Fuji Xerox"
1943+
],
1944+
"body": [
1945+
"FUJIFILM",
1946+
"Fuji Xerox",
1947+
"DocuPrint",
1948+
"DocuCentre",
1949+
"ApeosPort",
1950+
"Apeos"
1951+
],
1952+
"vendor": "fujifilm",
1953+
"devicetype": "printer"
1954+
},
1955+
"pantum-printer": {
1956+
"body": [
1957+
"Pantum",
1958+
"奔图",
1959+
"pantum\\.com"
1960+
],
1961+
"vendor": "pantum",
1962+
"devicetype": "printer"
1963+
},
1964+
"lenovo-printer": {
1965+
"body": [
1966+
"Lenovo LJ",
1967+
"Lenovo M",
1968+
"联想打印机"
1969+
],
1970+
"vendor": "lenovo",
1971+
"devicetype": "printer"
1972+
},
1973+
"zebra-printer": {
1974+
"headers": [
1975+
"Server: Zebra"
1976+
],
1977+
"body": [
1978+
"Zebra Technologies",
1979+
"ZTC",
1980+
"ZPL"
1981+
],
1982+
"vendor": "zebra",
1983+
"devicetype": "printer"
1984+
},
17911985
"dell-printer": {
17921986
"body": [
1793-
"Dell"
1987+
"Dell Printer",
1988+
"Dell Laser"
17941989
],
17951990
"vendor": "dell",
17961991
"devicetype": "printer"
17971992
},
1993+
"sindoh-printer": {
1994+
"body": [
1995+
"Sindoh"
1996+
],
1997+
"vendor": "sindoh",
1998+
"devicetype": "printer"
1999+
},
17982000
"cups-printer": {
17992001
"headers": [
18002002
"Server: CUPS"

pkg/stage/assets/port_fingerprints.json

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,41 @@
1414
]
1515
},
1616
"9100": {
17+
"devicetype": "printer",
1718
"tags": [
18-
"monitoring",
19-
"prometheus"
19+
"jetdirect",
20+
"raw-printing"
21+
]
22+
},
23+
"9101": {
24+
"devicetype": "printer",
25+
"tags": [
26+
"raw-printing"
27+
]
28+
},
29+
"9102": {
30+
"devicetype": "printer",
31+
"tags": [
32+
"raw-printing"
33+
]
34+
},
35+
"515": {
36+
"devicetype": "printer",
37+
"tags": [
38+
"lpd",
39+
"lpr"
40+
]
41+
},
42+
"631": {
43+
"devicetype": "printer",
44+
"tags": [
45+
"ipp",
46+
"cups"
47+
]
48+
},
49+
"161": {
50+
"tags": [
51+
"snmp"
2052
]
2153
},
2254
"3306": {

0 commit comments

Comments
 (0)