Skip to content

Commit

Permalink
Merge pull request #7 from tarihub/wildcard
Browse files Browse the repository at this point in the history
fix: file overwriting problem
  • Loading branch information
Esonhugh authored Mar 22, 2024
2 parents 0514447 + 3b67cfc commit b9622bb
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmd/all/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func RunBatch(net *net.IPNet) {

func printResult(records define.Records) {
if command.Opts.OutputFile != "" {
f, err := os.OpenFile(command.Opts.OutputFile, os.O_CREATE|os.O_WRONLY, 0644)
f, err := os.OpenFile(command.Opts.OutputFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
log.Warnf("OpenFile failed: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/axfr/axfr.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var AxfrCmd = &cobra.Command{
return
}
if command.Opts.OutputFile != "" {
f, err := os.OpenFile(command.Opts.OutputFile, os.O_CREATE|os.O_WRONLY, 0644)
f, err := os.OpenFile(command.Opts.OutputFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
log.Warnf("OpenFile failed: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var ServiceCmd = &cobra.Command{
}
records = scanner.ScanSvcForPorts(records)
if command.Opts.OutputFile != "" {
f, err := os.OpenFile(command.Opts.OutputFile, os.O_CREATE|os.O_WRONLY, 0644)
f, err := os.OpenFile(command.Opts.OutputFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
log.Warnf("OpenFile failed: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/subnet/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func BatchRun(net *net.IPNet) {

func printResult(records define.Records) {
if command.Opts.OutputFile != "" {
f, err := os.OpenFile(command.Opts.OutputFile, os.O_CREATE|os.O_WRONLY, 0644)
f, err := os.OpenFile(command.Opts.OutputFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
log.Warnf("OpenFile failed: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/wildcard/wildcard.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var WildCardCmd = &cobra.Command{

func printResult(records define.Records) {
if command.Opts.OutputFile != "" {
f, err := os.OpenFile(command.Opts.OutputFile, os.O_CREATE|os.O_WRONLY, 0644)
f, err := os.OpenFile(command.Opts.OutputFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
log.Warnf("OpenFile failed: %v", err)
}
Expand Down

0 comments on commit b9622bb

Please sign in to comment.