MCPcopy Index your code
hub / github.com/codingo/bbr / main

Function main

bbr.go:162–240  ·  view source on GitHub ↗

Starting point of the program

()

Source from the content-addressed store, hash-verified

160
161// Starting point of the program
162func main() {
163 flag.Parse()
164
165 err := validateFlags()
166 checkError(err)
167
168 // Reading template file
169 content, err := ioutil.ReadFile(*templateFile)
170 checkError(err)
171
172 inputFlags(content)
173
174 // Replacing the values
175 content = bytes.Replace(content, []byte("_target_"), []byte(*target), -1)
176 content = bytes.Replace(content, []byte("_username_"), []byte(*username), -1)
177 content = bytes.Replace(content, []byte("_program_"), []byte(*program), -1)
178 content = bytes.Replace(content, []byte("_researcher_"), []byte(*researcher), -1)
179
180 if bytes.Contains(content, []byte("_whois_")) {
181 whoIsTarget, err := whoIs()
182 checkError(err)
183 content = bytes.Replace(content, []byte("_whois_"), whoIsTarget, -1)
184 }
185
186 if bytes.Contains(content, []byte("_dig_")) {
187 digTarget, err := digTarget()
188 checkError(err)
189 content = bytes.Replace(content, []byte("_dig_"), digTarget, -1)
190 }
191
192 if bytes.Contains(content, []byte("_nameservers_")) {
193 nameServerTarget, err := nameServers()
194 checkError(err)
195 content = bytes.Replace(content, []byte("_nameservers_"), nameServerTarget, -1)
196 }
197
198 if bytes.Contains(content, []byte("_curl_")) {
199 curl, err := curlTarget()
200 checkError(err)
201 content = bytes.Replace(content, []byte("_curl_"), curl, -1)
202 }
203
204 if bytes.Contains(content, []byte("_sha_")) {
205 md := sha256Username()
206 content = bytes.Replace(content, []byte("_sha_"), md, -1)
207 }
208 var joke Joke
209
210 if bytes.Contains(content, []byte("_joke_")) {
211 err := getJoke(&joke)
212 checkError(err)
213 content = bytes.Replace(content, []byte("_joke_"), []byte(joke.Setup), -1)
214 }
215
216 if bytes.Contains(content, []byte("_punchline_")) {
217 // If joke is not processed before
218 if (Joke{}) == joke {
219 err := getJoke(&joke)

Callers

nothing calls this directly

Calls 10

validateFlagsFunction · 0.85
checkErrorFunction · 0.85
inputFlagsFunction · 0.85
whoIsFunction · 0.85
digTargetFunction · 0.85
nameServersFunction · 0.85
curlTargetFunction · 0.85
sha256UsernameFunction · 0.85
getJokeFunction · 0.85
getWayBackURLFunction · 0.85

Tested by

no test coverage detected