Skip to content

Commit

Permalink
put hackerone handle inside user pref enable bug bounty mode
Browse files Browse the repository at this point in the history
  • Loading branch information
yogeshojha committed Sep 6, 2024
1 parent 9beca84 commit 8bcdfa1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions web/targetApp/templates/target/add.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
<label for="targetDescription" class="form-label">Target Description (Optional)</label>
<input type="text" class="form-control form-control-lg" id="targetDescription" placeholder="Interesting Target" name="targetDescription">
</div>
{% if user_preferences.bug_bounty_mode %}
<div class="col-12 mt-3">
<label for="domainDescription" class="form-label">HackerOne Target Team Handle
<br>
Expand All @@ -88,6 +89,7 @@
<input type="text" class="form-control form-control-lg" id="targetH1TeamHandle" placeholder="team_handle" name="targetH1TeamHandle">
<button class="btn btn-primary submit-fn mt-2 float-end" disabled type="submit" name="add-ip-target" id="add-ip-target" value="submit"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-plus"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg> <span id="add_ip_target_btn">Add Target</span></button>
</div>
{% endif %}
</form>
</div>
</div>
Expand All @@ -103,13 +105,15 @@
<label for="targetDescription">Target Description (Optional)</label>
<input type="text" class="form-control form-control-lg" id="targetDescription" placeholder="Interesting Target" name="targetDescription">
</div>
{% if user_preferences.bug_bounty_mode %}
<div class="col-12 mt-3">
<label for="domainDescription" class="form-label">HackerOne Target Team Handle
<br>
This is used to send vulnerability reports to the HackerOne Program automatically. Team handle can be found from the program URL, <a href="https://hackerone.com/team_handle">https://hackerone.com/team_handle</a>
</label>
<input type="text" class="form-control form-control-lg" id="targetH1TeamHandle" placeholder="team_handle" name="targetH1TeamHandle">
</div>
{% endif %}
<div class="col-12 mt-3">
<label for="targetDescription">Target Organization (Optional)</label>
<input type="text" class="form-control form-control-lg" id="targetOrganization" placeholder="Example Org" name="targetOrganization">
Expand Down
2 changes: 2 additions & 0 deletions web/targetApp/templates/target/update.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ <h4 class="header-title">Update Target</h4>
{{ form.description }}
</div>
</div>
{% if user_preferences.bug_bounty_mode %}
<div class="col-12">
<label for="domainDescription" class="form-label">HackerOne Target Team Handle
<br>
This is used to send vulnerability reports to the HackerOne Program automatically. Team handle can be found from the program URL, hackerone.com/team_handle.
</label>
{{ form.h1_team_handle }}
</div>
{% endif %}
<button class="btn btn-primary submit-fn mt-2 float-end" type="submit">Update Target</button>
</form>
</div>
Expand Down
4 changes: 2 additions & 2 deletions web/targetApp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def add_target(request, slug):
bulk_targets = [t.rstrip() for t in request.POST['addTargets'].split('\n') if t]
logger.info(f'Adding multiple targets: {bulk_targets}')
description = request.POST.get('targetDescription', '')
h1_team_handle = request.POST.get('targetH1TeamHandle')
h1_team_handle = request.POST.get('targetH1TeamHandle', '')
organization_name = request.POST.get('targetOrganization')
for target in bulk_targets:
target = target.rstrip('\n')
Expand Down Expand Up @@ -242,7 +242,7 @@ def add_target(request, slug):
is_domain = bool(validators.domain(ip))
is_ip = bool(validators.ipv4(ip)) or bool(validators.ipv6(ip))
description = request.POST.get('targetDescription', '')
h1_team_handle = request.POST.get('targetH1TeamHandle')
h1_team_handle = request.POST.get('targetH1TeamHandle', '')
if not Domain.objects.filter(name=ip).exists():
domain, created = Domain.objects.get_or_create(
name=ip,
Expand Down

0 comments on commit 8bcdfa1

Please sign in to comment.