mirror of
https://github.com/danielmiessler/SecLists.git
synced 2025-04-27 17:26:29 -04:00
Merge pull request #926 from molangning/master
Improved validation process
This commit is contained in:
commit
7e128ab391
3 changed files with 55 additions and 3 deletions
39
.bin/new-line-and-empty-line-checker.py
Executable file
39
.bin/new-line-and-empty-line-checker.py
Executable file
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
# test string: ./.bin/new-line-checker.py "Fuzzing/file-extensions-all-cases.txt Fuzzing/file-extensions-lower-case.txt Fuzzing/file-extensions-upper-case.txt Fuzzing/file-extensions.txt"
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
print("[+] New line check")
|
||||
|
||||
if not sys.argv[1]:
|
||||
exit(0)
|
||||
|
||||
files=sys.argv[1].split(" ")
|
||||
|
||||
for i in files:
|
||||
if not os.path.isfile(i):
|
||||
print("[!] %s does not exist!"%(i))
|
||||
exit(2)
|
||||
|
||||
for i in files:
|
||||
f=open(i,"r")
|
||||
contents=f.read()
|
||||
|
||||
if contents[-1] == '\n':
|
||||
print("[!] %s ends with a new line!"%(i))
|
||||
exit(2)
|
||||
print("[+] %s passed new line check!"%(i))
|
||||
|
||||
counter=1
|
||||
|
||||
for line in contents.split('\n'):
|
||||
if len(line)==0:
|
||||
print("[!] %s has an empty entry at line %i!"%(i,counter))
|
||||
exit(2)
|
||||
counter+=1
|
||||
print("[+] %s passed empty line check!"%(i))
|
||||
|
||||
print("[+] All files passed checks")
|
||||
# exit(0)
|
11
.bin/validators.sh
Executable file
11
.bin/validators.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# https://stackoverflow.com/questions/3822621/how-to-exit-if-a-command-failed
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
# wrapper for all the checking scripts
|
||||
echo $1
|
||||
./.bin/check-file-for-starting-slash "$1"
|
||||
./.bin/new-line-and-empty-line-checker.py "$1"
|
|
@ -2,8 +2,10 @@
|
|||
# Sources:
|
||||
# https://dev.to/scienta/get-changed-files-in-github-actions-1p36
|
||||
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions
|
||||
# https://github.com/marketplace/actions/changed-files
|
||||
name: Wordlist Validator - Verify if any file entry start with a slash
|
||||
# https://github.com/marketplace/actions/changed-files\
|
||||
#
|
||||
# Modified to add a validator script
|
||||
name: Wordlist Validator - Runs a validator script to check for dangerous pushes
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
|
@ -26,4 +28,4 @@ jobs:
|
|||
uses: tj-actions/changed-files@v34
|
||||
- name: Analyze all added or modified files
|
||||
run: |
|
||||
./.bin/check-file-for-starting-slash "${{ steps.changed-files.outputs.all_changed_files }}"
|
||||
./.bin/validators.sh "${{ steps.changed-files.outputs.all_changed_files }}"
|
Loading…
Add table
Reference in a new issue