Skip to content

Commit

Permalink
replaced locationtagger with geotext
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4f53 committed Nov 12, 2023
1 parent 3e5978b commit 653112f
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 19 deletions.
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ Keep the following rules in mind when writing your own definitions:
### 4. Pull request

Submit a pull request and we'll pick it up and merge it if the changes look good.

For any queries, feel free to contact the developers and maintainers of this project
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ MIT License

Copyright (c) 2023 Owais Shaikh
Research @ RedHunt Labs Pvt Ltd
Email: [email protected] | [email protected]
Email: [email protected] | [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,6 @@ This tool is intended for research and educational purposes only. RedHunt Labs a

Copyright © 2023 RedHunt Labs Private Limited.

By Owais Shaikh ([email protected] | [email protected])
By Owais Shaikh
- Work: [email protected]
- Personal: [email protected]
2 changes: 1 addition & 1 deletion file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Copyright (c) Research @ RedHunt Labs Pvt Ltd
Written by Owais Shaikh
Email: [email protected] | [email protected]
Email: [email protected] | [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion image_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Copyright (c) Research @ RedHunt Labs Pvt Ltd
Written by Owais Shaikh
Email: [email protected] | [email protected]
Email: [email protected] | [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions octopii.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Copyright (c) Research @ RedHunt Labs Pvt Ltd
Written by Owais Shaikh
Email: [email protected] | [email protected]
Email: [email protected] | [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -42,7 +42,7 @@ def print_logo():
⠀⠀⠀⠀⠀⡳⠀⠧⣤⡳⣝⢤⠼⠀⡯⠀⠀⠈⠀ A PII scanner
⠀⠀⠀⠀⢀⣈⣋⣋⠮⡻⡪⢯⣋⢓⣉⡀ ______________
⠀⠀⠀⢀⣳⡁⡡⣅⠀⡗⣝⠀⡨⣅⢁⣗⠀⠀ (c) 2023 RedHunt Labs Pvt Ltd
⠀⠀⠀⠀⠈⠀⠸⣊⣀⡝⢸⣀⣸⠊⠀⠉⠀⠀⠀⠀by Owais Shaikh
⠀⠀⠀⠀⠈⠀⠸⣊⣀⡝⢸⣀⣸⠊⠀⠉⠀⠀⠀⠀by Owais Shaikh ([email protected] | [email protected])
⠀⠀⠀⠀⠀⠀⠀⠈⠈⠀⠀⠈⠈'''
print (logo)

Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ deskew
tensorflow
textract
pdf2image
locationtagger
keras
matplotlib
pytesseract # along with: sudo apt install tesseract-ocr -y
Expand All @@ -15,4 +14,6 @@ pillow
imutils
xmltodict
nltk
bs4
bs4
requests
geotext
15 changes: 4 additions & 11 deletions text_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Copyright (c) Research @ RedHunt Labs Pvt Ltd
Written by Owais Shaikh
Email: [email protected] | [email protected]
Email: [email protected] | [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -101,17 +101,10 @@ def read_pdf(pdf):

# python -m spacy download en_core_web_sm
def regional_pii(text):
import locationtagger
try:
place_entity = locationtagger.find_locations(text = text)
except LookupError:
nltk.downloader.download('punkt')
nltk.download('averaged_perceptron_tagger')
nltk.download('maxent_ne_chunker')
nltk.download('words')
place_entity = locationtagger.find_locations(text = text)
from geotext import GeoText
place_entity = GeoText(text)

final_output = place_entity.address_strings + place_entity.regions + place_entity.countries
final_output = list(set(place_entity.cities + place_entity.countries)
return final_output

def keywords_classify_pii(rules, intelligible_text_list):
Expand Down
41 changes: 41 additions & 0 deletions webhook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"""
MIT License
Copyright (c) Research @ RedHunt Labs Pvt Ltd
Written by Owais Shaikh
Email: [email protected] | [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

import requests

def push_data(data: str, url: str):
headers = {'Content-type': 'application/json'}
data = f"{"text":'{data}'}"

req = requests.post (
url, # Example: https://hooks.slack.com/services/<>/<>/<>
headers=headers,
data=data,
timeout=7
)

if req is not None and req.status_code == 200: print('Scan results sent to webhook.')
else: print('Couldn\'t send scan results to webhook. Reason: ' + req.text)

0 comments on commit 653112f

Please sign in to comment.