Starting point of the program
()
| 160 | |
| 161 | // Starting point of the program |
| 162 | func 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) |
nothing calls this directly
no test coverage detected