Browse Source

Added default placeholder route

master
Samuel Pua 6 years ago
parent
commit
5aca716e33
  1. 10
      tapit-backend/global-settings.go
  2. 3
      tapit-backend/main.go
  3. BIN
      tapit-backend/tapit-backend
  4. 12
      tapit-backend/web-template.go
  5. 2
      tapit-build/static/main.js
  6. BIN
      tapit-build/tapit
  7. 2
      tapit-frontend/src/app/global-settings.service.ts
  8. 4
      tapit-frontend/src/app/global-settings/global-settings.component.html
  9. 2
      tapit-frontend/src/app/global-settings/global-settings.component.ts

10
tapit-backend/global-settings.go

@ -17,7 +17,7 @@ type GlobalSettings struct {
MaxRequestRetries int
WaitBeforeRetry int
WebTemplatePrefix string
WebTemplateRoute string
WebFrontPlaceholder string
}
type GlobalSettingsJson struct {
@ -27,7 +27,7 @@ type GlobalSettingsJson struct {
MaxRequestRetries int `json:"maxRequestRetries"`
WaitBeforeRetry int `json:"waitBeforeRetry"`
WebTemplatePrefix string `json:"webTemplatePrefix"`
WebTemplateRoute string `json:"webTemplateRoute"`
WebFrontPlaceholder string `json:"webFrontPlaceholder"`
}
@ -60,14 +60,14 @@ func (tapit *Tapit) updateGlobalSettings(w http.ResponseWriter, r *http.Request)
http.Error(w, "Bad request", 400)
return
}
if globalSettingsJson.SecretRegistrationCode != "" && globalSettingsJson.ThreadsPerCampaign != 0 && globalSettingsJson.BcryptCost != 0 && globalSettingsJson.WebTemplatePrefix != "" && globalSettingsJson.WebTemplateRoute != "" {
if globalSettingsJson.SecretRegistrationCode != "" && globalSettingsJson.ThreadsPerCampaign != 0 && globalSettingsJson.BcryptCost != 0 && globalSettingsJson.WebTemplatePrefix != "" {
globalSettings.SecretRegistrationCode = globalSettingsJson.SecretRegistrationCode
globalSettings.ThreadsPerCampaign = globalSettingsJson.ThreadsPerCampaign
globalSettings.BcryptCost = globalSettingsJson.BcryptCost
globalSettings.MaxRequestRetries = globalSettingsJson.MaxRequestRetries
globalSettings.WaitBeforeRetry = globalSettingsJson.WaitBeforeRetry
globalSettings.WebTemplatePrefix = globalSettingsJson.WebTemplatePrefix
globalSettings.WebTemplateRoute = globalSettingsJson.WebTemplateRoute
globalSettings.WebFrontPlaceholder = globalSettingsJson.WebFrontPlaceholder
err = tapit.db.Save(&globalSettings).Error
if err != nil {
@ -96,7 +96,7 @@ func (tapit *Tapit) getGlobalSettings(w http.ResponseWriter, r *http.Request) {
globalSettingsJson.MaxRequestRetries = globalSettings.MaxRequestRetries
globalSettingsJson.WaitBeforeRetry = globalSettings.WaitBeforeRetry
globalSettingsJson.WebTemplatePrefix = globalSettings.WebTemplatePrefix
globalSettingsJson.WebTemplateRoute = globalSettings.WebTemplateRoute
globalSettingsJson.WebFrontPlaceholder = globalSettings.WebFrontPlaceholder
jsonResults, err := json.Marshal(globalSettingsJson)
if err != nil {

3
tapit-backend/main.go

@ -88,7 +88,7 @@ func main() {
globalSettings.MaxRequestRetries = 5
globalSettings.WaitBeforeRetry = 1000
globalSettings.WebTemplatePrefix = "https://www.attacker.com/"
globalSettings.WebTemplateRoute = "/"
globalSettings.WebFrontPlaceholder = ""
tapit.db.NewRecord(&globalSettings)
tapit.db.Create(&globalSettings)
@ -166,6 +166,7 @@ func main() {
// Handle WebTemplate Routes
webTemplateRouter := mux.NewRouter()
webTemplateRouter.HandleFunc("/", tapit.handleWebFront)
webTemplateRouter.HandleFunc("/{route}", tapit.webTemplateRouteHandler)
// Starting victim route web server

BIN
tapit-backend/tapit-backend

Binary file not shown.

12
tapit-backend/web-template.go

@ -438,6 +438,18 @@ func (tapit *Tapit) webTemplateRouteHandler(w http.ResponseWriter, r *http.Reque
return
}
func (tapit *Tapit) handleWebFront(w http.ResponseWriter, r *http.Request) {
var globalSettings GlobalSettings
err := tapit.db.Last(&globalSettings).Error
if err != nil {
w.Write([]byte(""))
return
}
w.Write([]byte(globalSettings.WebFrontPlaceholder))
return
}
func (tapit *Tapit) handleDownloadView(w http.ResponseWriter, r *http.Request) {
if strings.ToUpper(r.Method) == "GET" {
var csvBuffer bytes.Buffer

2
tapit-build/static/main.js

File diff suppressed because one or more lines are too long

BIN
tapit-build/tapit

Binary file not shown.

2
tapit-frontend/src/app/global-settings.service.ts

@ -11,7 +11,7 @@ export class GlobalSettings {
maxRequestRetries: number;
waitBeforeRetry: number;
webTemplatePrefix: string;
webTemplateRoute: string;
webFrontPlaceholder: string;
}
export class GlobalSettingsNotification {

4
tapit-frontend/src/app/global-settings/global-settings.component.html

@ -43,8 +43,8 @@
</div>
<div class="row mt-3">
<div class="col-12 d-flex">
<label for="web-route" class="pr-2 mt-auto mb-auto">Web Route</label>
<input type="text" class="flex-grow-1" id="web-route" [(ngModel)]="displaySettings.webTemplateRoute" >
<label for="webfront-placeholder" class="pr-2 mt-auto mb-auto">Frontpage Placeholder</label>
<textarea class="form-control flex" [(ngModel)]="displaySettings.webFrontPlaceholder" id="webfront-placeholder" rows="6"></textarea>
</div>
</div>
<div class="row mt-3">

2
tapit-frontend/src/app/global-settings/global-settings.component.ts

@ -14,7 +14,7 @@ export class GlobalSettingsComponent implements OnInit {
updateGlobalSettings() {
this.tempSettings.secretRegistrationCode = this.displaySettings.secretRegistrationCode;
this.tempSettings.webTemplatePrefix = this.displaySettings.webTemplatePrefix;
this.tempSettings.webTemplateRoute = this.displaySettings.webTemplateRoute;
this.tempSettings.webFrontPlaceholder = this.displaySettings.webFrontPlaceholder;
this.tempSettings.threadsPerCampaign = parseInt(this.displaySettings.threadsPerCampaign, 10) + 0;
this.tempSettings.bcryptCost = parseInt(this.displaySettings.bcryptCost, 10);
this.tempSettings.maxRequestRetries = parseInt(this.displaySettings.maxRequestRetries, 10);

Loading…
Cancel
Save