Skip to content

Commit 47a657c

Browse files
committed
🚀 Let's go
0 parents  commit 47a657c

File tree

10 files changed

+608
-0
lines changed

10 files changed

+608
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: '[BUG] '
5+
labels: 'bug'
6+
assignees: 'richardevcom'
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Run command '...'
16+
2. With parameters '....'
17+
3. On directory/file '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**System Information:**
27+
- OS: [e.g. Ubuntu 20.04]
28+
- Bash version: [e.g. 5.0.17]
29+
- Tool Version: [e.g. 1.1.0]
30+
31+
**Additional context**
32+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: '[FEATURE] '
5+
labels: 'enhancement'
6+
assignees: 'richardevcom'
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/workflows/test.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Flag Search Bash Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- name: ShellCheck
17+
run: |
18+
sudo apt-get update
19+
sudo apt-get install -y shellcheck
20+
shellcheck tools/flagsearch.sh
21+
22+
- name: Basic functionality test
23+
run: |
24+
chmod +x tools/flagsearch.sh
25+
# Create test directory and files
26+
mkdir -p test/
27+
echo "This is a test flag{test123}" > test/testfile.txt
28+
touch test/flag_file.txt
29+
# Test filename search
30+
./tools/flagsearch.sh -f flag -i test/ | grep -q "Found file"
31+
# Test content search
32+
./tools/flagsearch.sh -f flag -i test/testfile.txt | grep -q "Found flag"
33+
# Test deep search
34+
./tools/flagsearch.sh -f flag -i test/ -d | grep -q "Found flag"
35+
36+
- name: Cleanup
37+
run: |
38+
rm -rf test/

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# OS generated files
2+
.DS_Store
3+
.DS_Store?
4+
._*
5+
.Spotlight-V100
6+
.Trashes
7+
ehthumbs.db
8+
Thumbs.db
9+
10+
# Editor directories and files
11+
.idea
12+
.vscode
13+
*.swp
14+
*.swo
15+
*~
16+
17+
# Logs
18+
*.log
19+
20+
# Temporary files
21+
tmp/
22+
temp/
23+
*.tmp
24+
25+
# User-specific files
26+
*.bak

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## [1.1.0] - 2023-11-06
6+
7+
### Added
8+
- Initial public repository release
9+
- Comprehensive documentation
10+
- MIT license
11+
- Renamed tool from "flags" to "flagsearch"
12+
13+
### Changed
14+
- Improved code comments
15+
- Enhanced error handling
16+
- Updated all documentation to reflect new name
17+
18+
## [1.0.2] - 2023-10-25
19+
20+
# ...existing code...

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Ricards Mucelans
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Flag Search Tool
2+
3+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4+
[![Version: 1.1.0](https://img.shields.io/badge/Version-1.1.0-blue.svg)](https://github.com/richardevcom/flagsearch)
5+
6+
A powerful command-line tool designed to help CTF participants and security professionals search for flags within files and directories. This tool can search both file names and file contents for specified flag patterns.
7+
8+
## 🚀 Features
9+
10+
- Search for flags in filenames
11+
- Deep search within file content
12+
- Color-coded output for better readability
13+
- Clean and intuitive user interface
14+
- Works with single files or entire directories
15+
16+
## 📋 Requirements
17+
18+
- Bash 4.0 or later
19+
- Standard Unix utilities (`grep`, `find`, etc.)
20+
- Read permissions to files you want to search
21+
22+
## 🔧 Installation
23+
24+
1. Clone the repository:
25+
```bash
26+
git clone https://github.com/richardevcom/flagsearch.git
27+
cd flagsearch
28+
```
29+
30+
2. Make the script executable:
31+
```bash
32+
chmod +x tools/flagsearch.sh
33+
```
34+
35+
3. Optionally, create a symbolic link to use the tool from anywhere:
36+
```bash
37+
sudo ln -s $(pwd)/tools/flagsearch.sh /usr/local/bin/flagsearch
38+
```
39+
40+
## 🔎 Usage
41+
42+
Basic syntax:
43+
```bash
44+
./tools/flagsearch.sh -f <flag_pattern> -i <input_path> [-d]
45+
```
46+
47+
### Parameters:
48+
- `-f` - Pattern to search for (required)
49+
- `-i` - Input file or directory to search in (required)
50+
- `-d` - Enable deep search (search within file contents - optional, only applicable with directory input)
51+
52+
### Examples:
53+
54+
1. Search for files with "flag" in the filename:
55+
```bash
56+
./tools/flagsearch.sh -f flag -i /path/to/ctf/files
57+
```
58+
59+
2. Search for files containing "flag{" in their content:
60+
```bash
61+
./tools/flagsearch.sh -f flag{ -i /path/to/ctf/files -d
62+
```
63+
64+
3. Search for a specific flag format in a single file:
65+
```bash
66+
./tools/flagsearch.sh -f "flag{[A-Za-z0-9]+" -i suspicious_file.txt
67+
```
68+
69+
## 🤝 Contributing
70+
71+
Contributions are welcome! Please feel free to submit a Pull Request.
72+
73+
1. Fork the project
74+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
75+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
76+
4. Push to the branch (`git push origin feature/amazing-feature`)
77+
5. Open a Pull Request
78+
79+
## 📜 License
80+
81+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
82+
83+
## ✉️ Contact
84+
85+
richardevcom - [@richardevcom](https://twitter.com/richardevcom)
86+
87+
Project Link: [https://github.com/richardevcom/flagsearch](https://github.com/richardevcom/flagsearch)

docs/INSTALLATION.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Installation Guide
2+
3+
This document provides detailed instructions for installing and setting up the Flag Search Tool.
4+
5+
## Prerequisites
6+
7+
Before installing, ensure your system meets these requirements:
8+
9+
- Bash 4.0 or later
10+
- Standard Unix utilities (`grep`, `find`, etc.)
11+
- Git (for cloning the repository)
12+
- Sufficient permissions to make files executable
13+
14+
## Basic Installation
15+
16+
### Step 1: Clone the Repository
17+
18+
```bash
19+
git clone https://github.com/richardevcom/flagsearch.git
20+
cd flagsearch
21+
```
22+
23+
### Step 2: Make the Script Executable
24+
25+
```bash
26+
chmod +x tools/flagsearch.sh
27+
```
28+
29+
Now you can run the script using:
30+
31+
```bash
32+
./tools/flagsearch.sh -f <flag_pattern> -i <input_path> [-d]
33+
```
34+
35+
## System-Wide Installation
36+
37+
To make the tool available system-wide:
38+
39+
### Option 1: Create a Symbolic Link
40+
41+
```bash
42+
sudo ln -s $(pwd)/tools/flagsearch.sh /usr/local/bin/flagsearch
43+
```
44+
45+
After creating the link, you can use the tool from anywhere by typing:
46+
47+
```bash
48+
flagsearch -f <flag_pattern> -i <input_path> [-d]
49+
```
50+
51+
### Option 2: Copy to a Directory in PATH
52+
53+
Alternatively, you can copy the script to a directory in your PATH:
54+
55+
```bash
56+
sudo cp tools/flagsearch.sh /usr/local/bin/flagsearch
57+
sudo chmod +x /usr/local/bin/flagsearch
58+
```
59+
60+
## Verification
61+
62+
Verify your installation by checking the version:
63+
64+
```bash
65+
./tools/flagsearch.sh -v
66+
```
67+
68+
or if installed system-wide:
69+
70+
```bash
71+
flagsearch -v
72+
```
73+
74+
## Troubleshooting
75+
76+
If you encounter any issues during installation:
77+
78+
1. Ensure you have proper permissions
79+
2. Check that all prerequisites are installed
80+
3. Verify that the script has execute permissions
81+
82+
For more help, please open an issue on our [GitHub repository](https://github.com/richardevcom/flagsearch/issues).

0 commit comments

Comments
 (0)