File: fab.rb

package info (click to toggle)
cewl 5.4.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 224 kB
  • sloc: ruby: 1,962; makefile: 7; sh: 6
file content (88 lines) | stat: -rw-r--r-- 1,393 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env ruby

# == FAB: Files Already Bagged
#
# This script can be ran against files already
# downloaded from a target site to generate a list
# of usernames and email addresses based on meta
# data contained within them.
#
# To see a list of file types which can be processed
# see cewl_lib.rb
#
# == Usage
#
# fab-cewl [OPTION] ... filename/list
#
# -h, --help:
#    show help
#
# -v
#    verbose
#
# filename/list: the file or list of files to check
#
# Author:: Robin Wood (robin@digininja.org)
# Copyright:: Copyright (c) Robin Wood 2016
# Licence:: GPL
#

require "rubygems"
require 'getoptlong'
require "cewl_lib.rb"

opts = GetoptLong.new(
	[ '--help', '-h', GetoptLong::NO_ARGUMENT ],
	[ "-v" , GetoptLong::NO_ARGUMENT ]
)

def usage
	puts"fab-cewl

Usage: fab-cewl [OPTION] ... filename/list
	-h, --help: show help
	-v: verbose
	
	filename/list: the file or list of files to check

"
	exit
end

verbose=false

begin
	opts.each do |opt, arg|
		case opt
		when '--help'
			usage
		when '-v'
			verbose=true
		end
	end
rescue
	usage
end

if ARGV.length < 1
	puts "Missing filename/list (try --help)"
	exit 0
end

meta_data=[]

ARGV.each { |param|
	data=process_file(param, verbose)
	if(data!=nil)
		meta_data+=data
	end
}

meta_data.delete_if { |x| x.chomp==""}
meta_data.uniq!
meta_data.sort!
if meta_data.length==0
	puts "No data found\n"
else
	puts meta_data.join("\n")
end