Git Product home page Git Product logo

zflags's Introduction

ZMap: The Internet Scanner

Build Status

ZMap is a fast single packet network scanner designed for Internet-wide network surveys. On a typical desktop computer with a gigabit Ethernet connection, ZMap is capable scanning the entire public IPv4 address space on a single port in under 45 minutes. With a 10gigE connection and netmap or PF_RING, ZMap can scan the IPv4 address space in under 5 minutes.

ZMap operates on GNU/Linux, Mac OS, and BSD. ZMap currently has fully implemented probe modules for TCP SYN scans, ICMP, DNS queries, UPnP, BACNET, and can send a large number of UDP probes. If you are looking to do more involved scans (e.g., banner grab or TLS handshake), take a look at ZGrab 2, ZMap's sister project that performs stateful application-layer handshakes.

Using ZMap

If you haven't used ZMap before, we have a step-by-step Getting Started Guide that details how to perform basic scans. Documentation about all of ZMap's options and more advanced functionality can be found in our Wiki.

If you have questions, please first check our FAQ. Still have questions? Ask the community in Github Discussions. Please do not create an Issue for usage or support questions.

Installation

The latest stable release of ZMap is 4.2.0 and supports Linux, macOS, and BSD.

Instructions on building ZMap from source can be found in INSTALL.

Architecture

More information about ZMap's architecture and a comparison with other tools can be found in these two research papers:

If you use ZMap for published research, please cite the original research paper:

@inproceedings{durumeric2013zmap,
  title={{ZMap}: Fast Internet-wide scanning and its security applications},
  author={Durumeric, Zakir and Wustrow, Eric and Halderman, J Alex},
  booktitle={22nd USENIX Security Symposium},
  year={2013}
}

Citing the ZMap paper helps us to track ZMap usage within the research community and to pursue funding for continued development.

License and Copyright

ZMap Copyright 2023 Regents of the University of Michigan

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See LICENSE for the specific language governing permissions and limitations under the License.

zflags's People

Contributors

alex-slynko avatar bengadbois avatar bigwhoop avatar blampe avatar dadrian avatar davecgh avatar fabiokung avatar gebi avatar jessevdk avatar jkieboom avatar justinbastress avatar kkolman avatar lrstanley avatar marksteve avatar melor avatar meteorite avatar mpobrien avatar mvo5 avatar pierrec avatar piranha avatar rlmcpherson avatar sergiusens avatar shirayu avatar sqs avatar stevenwilkin avatar stuart-pollock avatar xenophex avatar zakird avatar zimmski avatar zyga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

zflags's Issues

Unify JSON/zflags tags?

I often end up with code like this:

type MyFlags struct {
   Field1 string `long:"field1" json:"field1,omitempty"`
   Field2 int `long:"field2" json:"field2"`
   // ...
}

We could write a custom JSON processor that uses long as the JSON field name when json is not present, but it would probably be simpler to have zflags use the json field if long is not present.

This could get us closer to allowing JSON/YAML config in addition to the INI format.

Fix unit tests

On Windows, go test -v results in the following:

=== RUN   TestPositional
--- PASS: TestPositional (0.00s)
=== RUN   TestPositionalRequired
--- PASS: TestPositionalRequired (0.00s)
=== RUN   TestPositionalRequiredRest1Fail
--- PASS: TestPositionalRequiredRest1Fail (0.00s)
=== RUN   TestPositionalRequiredRest1Pass
--- PASS: TestPositionalRequiredRest1Pass (0.00s)
=== RUN   TestPositionalRequiredRest2Fail
--- PASS: TestPositionalRequiredRest2Fail (0.00s)
=== RUN   TestPositionalRequiredRest2Pass
--- PASS: TestPositionalRequiredRest2Pass (0.00s)
=== RUN   TestPositionalRequiredRestRangeFail
--- PASS: TestPositionalRequiredRestRangeFail (0.00s)
=== RUN   TestPositionalRequiredRestRangeEmptyFail
--- PASS: TestPositionalRequiredRestRangeEmptyFail (0.00s)
=== RUN   TestCommandInline
--- PASS: TestCommandInline (0.00s)
=== RUN   TestCommandInlineMulti
--- PASS: TestCommandInlineMulti (0.00s)
=== RUN   TestCommandFlagOrder1
--- PASS: TestCommandFlagOrder1 (0.00s)
=== RUN   TestCommandFlagOrder2
--- PASS: TestCommandFlagOrder2 (0.00s)
=== RUN   TestCommandFlagOrderSub
--- PASS: TestCommandFlagOrderSub (0.00s)
=== RUN   TestCommandFlagOverride1
--- PASS: TestCommandFlagOverride1 (0.00s)
=== RUN   TestCommandFlagOverride2
--- PASS: TestCommandFlagOverride2 (0.00s)
=== RUN   TestCommandFlagOverrideSub
--- PASS: TestCommandFlagOverrideSub (0.00s)
=== RUN   TestCommandFlagOverrideSub2
--- PASS: TestCommandFlagOverrideSub2 (0.00s)
=== RUN   TestCommandEstimate
--- PASS: TestCommandEstimate (0.00s)
=== RUN   TestCommandEstimate2
--- PASS: TestCommandEstimate2 (0.00s)
=== RUN   TestCommandValidate
--- PASS: TestCommandValidate (0.00s)
=== RUN   TestCommandClosest
--- PASS: TestCommandClosest (0.00s)
=== RUN   TestCommandAdd
--- PASS: TestCommandAdd (0.00s)
=== RUN   TestCommandNestedInline
--- PASS: TestCommandNestedInline (0.00s)
=== RUN   TestRequiredOnCommand
--- PASS: TestRequiredOnCommand (0.00s)
=== RUN   TestRequiredAllOnCommand
--- PASS: TestRequiredAllOnCommand (0.00s)
=== RUN   TestDefaultOnCommand
--- PASS: TestDefaultOnCommand (0.00s)
=== RUN   TestAfterNonCommand
--- PASS: TestAfterNonCommand (0.00s)
=== RUN   TestSubcommandsOptional
--- PASS: TestSubcommandsOptional (0.00s)
=== RUN   TestSubcommandsOptionalAfterNonCommand
--- PASS: TestSubcommandsOptionalAfterNonCommand (0.00s)
=== RUN   TestCommandAlias
--- PASS: TestCommandAlias (0.00s)
=== RUN   TestSubCommandFindOptionByLongFlag
--- PASS: TestSubCommandFindOptionByLongFlag (0.00s)
=== RUN   TestSubCommandFindOptionByShortFlag
--- PASS: TestSubCommandFindOptionByShortFlag (0.00s)
=== RUN   TestCompletion
--- FAIL: TestCompletion (0.00s)
	completion_test.go:262: Args: []string{"-"}, false
		  Expected: []string{"--debug", "--required", "--verbose", "--version", "-i"}
		  Got:     []string{"/debug", "/i", "/required", "/verbose", "/version"}
	completion_test.go:262: Args: []string{"--"}, false
		  Expected: []string{"--debug", "--required", "--verbose", "--version"}
		  Got:     []string{"/debug", "/required", "/verbose", "/version"}
	completion_test.go:262: Args: []string{"--ver"}, false
		  Expected: []string{"--verbose", "--version"}
		  Got:     []string{"/verbose", "/version"}
=== RUN   TestParserCompletion
--- FAIL: TestParserCompletion (0.00s)
	completion_test.go:310: Expected: []string{"--debug", "--required", "--verbose", "--version", "-i"}
		Got: []string{"/debug", "/i", "/required", "/verbose", "/version"}
	completion_test.go:310: Expected: []string{"--debug", "--required", "--verbose", "--version"}
		Got: []string{"/debug", "/required", "/verbose", "/version"}
	completion_test.go:310: Expected: []string{"--debug     # Enable debug", "--required  # This is required", "--verbose   # Verbose messages", "--version   # Show version"}
		Got: []string{"/debug     # Enable debug", "/required  # This is required", "/verbose   # Verbose messages", "/version   # Show version"}
	completion_test.go:310: Expected: []string{"--verbose", "--version"}
		Got: []string{"/verbose", "/version"}
=== RUN   TestConvertToString
--- PASS: TestConvertToString (0.00s)
=== RUN   TestConvertToStringInvalidIntBase
--- PASS: TestConvertToStringInvalidIntBase (0.00s)
=== RUN   TestConvertToStringInvalidUintBase
--- PASS: TestConvertToStringInvalidUintBase (0.00s)
=== RUN   TestGroupInline
--- PASS: TestGroupInline (0.00s)
=== RUN   TestGroupAdd
--- PASS: TestGroupAdd (0.00s)
=== RUN   TestGroupNestedInline
--- PASS: TestGroupNestedInline (0.00s)
=== RUN   TestGroupNestedInlineNamespace
--- PASS: TestGroupNestedInlineNamespace (0.00s)
=== RUN   TestDuplicateShortFlags
--- PASS: TestDuplicateShortFlags (0.00s)
=== RUN   TestDuplicateLongFlags
--- PASS: TestDuplicateLongFlags (0.00s)
=== RUN   TestFindOptionByLongFlag
--- PASS: TestFindOptionByLongFlag (0.00s)
=== RUN   TestFindOptionByShortFlag
--- PASS: TestFindOptionByShortFlag (0.00s)
=== RUN   TestFindOptionByLongFlagInSubGroup
--- PASS: TestFindOptionByLongFlagInSubGroup (0.00s)
=== RUN   TestFindOptionByShortFlagInSubGroup
--- PASS: TestFindOptionByShortFlagInSubGroup (0.00s)
=== RUN   TestHelp
--- PASS: TestHelp (0.00s)
=== RUN   TestMan
--- PASS: TestMan (0.00s)
=== RUN   TestHelpCommand
--- PASS: TestHelpCommand (0.00s)
=== RUN   TestHelpDefaults
--- PASS: TestHelpDefaults (0.00s)
=== RUN   TestHelpRestArgs
--- PASS: TestHelpRestArgs (0.00s)
=== RUN   TestWrapText
--- PASS: TestWrapText (0.00s)
=== RUN   TestWrapParagraph
--- PASS: TestWrapParagraph (0.00s)
=== RUN   TestHelpDefaultMask
--- PASS: TestHelpDefaultMask (0.00s)
=== RUN   TestWriteIni
--- PASS: TestWriteIni (0.00s)
=== RUN   TestReadIni_flagEquivalent
--- FAIL: TestReadIni_flagEquivalent (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x558ccc]

goroutine 108 [running]:
testing.tRunner.func1(0xc042232d20)
	C:/Go/src/testing/testing.go:711 +0x2d9
panic(0x5c2040, 0x6f3da0)
	C:/Go/src/runtime/panic.go:491 +0x291
github.com/zmap/zflags.(*IniParser).parse(0xc04202bec8, 0xc0422d5c40, 0x0, 0x0, 0xc0422d5c40, 0x0, 0x0, 0x5d8800, 0xc0422e3101, 0xc0422d5c20)
	C:/Users/localadmin/go/src/github.com/zmap/zflags/ini.go:603 +0xabc
github.com/zmap/zflags.(*IniParser).Parse(0xc04202bec8, 0x6e4920, 0xc0422d5c20, 0x5fed1f, 0x17, 0x5a3080, 0xc0422c4f28, 0xc0422e3290, 0x0, 0x0, ...)
	C:/Users/localadmin/go/src/github.com/zmap/zflags/ini.go:142 +0xd8
github.com/zmap/zflags.TestReadIni_flagEquivalent.func1(0x607a33, 0x9b, 0x6ab0b8, 0xf, 0x6e0f15)
	C:/Users/localadmin/go/src/github.com/zmap/zflags/ini_test.go:325 +0x21f
github.com/zmap/zflags.TestReadIni_flagEquivalent(0xc042232d20)
	C:/Users/localadmin/go/src/github.com/zmap/zflags/ini_test.go:337 +0x93
testing.tRunner(0xc042232d20, 0x60a8b0)
	C:/Go/src/testing/testing.go:746 +0xd7
created by testing.(*T).Run
	C:/Go/src/testing/testing.go:789 +0x2e5
exit status 2
FAIL	github.com/zmap/zflags	0.087s

The former is presumably Windows-specific, but the latter seems to be universal.

Unify godoc / description?

In practice, I often end up with code like this:

type Flags struct {
  // Flag1 does whatever flag1 does
  Flag1 string `long:"flag1" description:"Does whatever flag1 does"`
  // Flag2 does whatever flag2 does
  Flag2 string `long:"flag2" description:"Does whatever flag2 does"`
  // ...etc
}

where the field godocs are basically identical to the description, which opens us up to all the problems of code duplication (easy to get out of sync etc).

One solution would be code generation; another might be to have the description field read from the field's godoc when absent (assumes that source is available)...

Pull args from environment variables?

In some cases at least, it would be nice to be able to provide flags via environment variables; probably overridden by any explicit values from the command line / INI.

A new tag, e.g. env, could allow an explicit variable name, or in its absence it could use long (flags with only short would probably not be appropriate).

This could be gated by a flag to the parser.

Default arguments don't work properly with multiply declared groups

When processing .ini files, ZFlags supports multiple instances of the same group name. However, when options have default parameters, the defaults are only applied when parsing one instance of the group.

This issue breaks ZGrab2's multiple feature. For example, this mult.ini:

[http]
port=80

[http]
name=8080

Invoking echo 209.140.247.232 | ./zgrab2 multiple -c mult.ini should return success for both ports 80 and 8080. However, one port or the other, at random, will instead return:

{"status":"unknown-error","protocol":"http","result":{},"timestamp":"2018-06-26T20:42:41-04:00","error":"http: no client.UserAgent set"}

because the --user-agent parameter didn't take its default value.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.