ptnote 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ptnote-1.0.0/LICENSE +7 -0
- ptnote-1.0.0/PKG-INFO +209 -0
- ptnote-1.0.0/README.md +188 -0
- ptnote-1.0.0/ptnote/__init__.py +1 -0
- ptnote-1.0.0/ptnote/cli.py +205 -0
- ptnote-1.0.0/ptnote/config_settings.py +23 -0
- ptnote-1.0.0/ptnote.egg-info/PKG-INFO +209 -0
- ptnote-1.0.0/ptnote.egg-info/SOURCES.txt +11 -0
- ptnote-1.0.0/ptnote.egg-info/dependency_links.txt +1 -0
- ptnote-1.0.0/ptnote.egg-info/entry_points.txt +2 -0
- ptnote-1.0.0/ptnote.egg-info/top_level.txt +2 -0
- ptnote-1.0.0/pyproject.toml +35 -0
- ptnote-1.0.0/setup.cfg +4 -0
ptnote-1.0.0/LICENSE
ADDED
ptnote-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ptnote
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A fast terminal note manager for penetration testers.
|
|
5
|
+
Author: Salih
|
|
6
|
+
License: ## License
|
|
7
|
+
|
|
8
|
+
PtNote is licensed under the PolyForm Noncommercial License 1.0.0.
|
|
9
|
+
|
|
10
|
+
You may use, modify, and share PtNote for personal, educational, and non-commercial purposes.
|
|
11
|
+
|
|
12
|
+
Commercial use requires explicit permission from the author.
|
|
13
|
+
Keywords: pentest,ctf,notes,security,terminal
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Environment :: Console
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# PtNote
|
|
23
|
+
|
|
24
|
+
**PtNote** is a lightweight terminal-based note manager designed for penetration testers and CTF players. It lets you quickly create, organize, and manage notes directly from the command line without leaving your workflow.
|
|
25
|
+
|
|
26
|
+
## Features
|
|
27
|
+
|
|
28
|
+
- Create separate notes for each target
|
|
29
|
+
- Select an active note
|
|
30
|
+
- Add notes instantly
|
|
31
|
+
- Display note contents
|
|
32
|
+
- Clear a note while preserving the template
|
|
33
|
+
- List all available notes
|
|
34
|
+
- Set target information
|
|
35
|
+
- Admin
|
|
36
|
+
- IP Address
|
|
37
|
+
- Domain
|
|
38
|
+
- Rename existing notes
|
|
39
|
+
- Delete notes
|
|
40
|
+
- Show the currently selected note
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
# Installation
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install ptnote
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
# Usage
|
|
53
|
+
|
|
54
|
+
## Create a new note
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
ptnote new target1
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Creates a new note using the default template.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Select a note
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
ptnote select target1
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Sets the selected note as the active note.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Add a note
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
ptnote add "Found SQL Injection on /login"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Appends a new line to the active note.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Show a note
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
ptnote show target1
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Displays the contents of the specified note.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Clear a note
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
ptnote clear target1
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Resets the note to the default template.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## List notes
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
ptnote list
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Lists all available notes.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Set target information
|
|
115
|
+
|
|
116
|
+
Set administrator:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
ptnote set admin administrator
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Set IP address:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
ptnote set ip 192.168.1.10
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Set domain:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
ptnote set domain example.com
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Rename a note
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
ptnote rename target1 target2
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Renames both the note folder and its file.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Delete a note
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
ptnote delete target2
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Deletes the specified note after confirmation.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Show current active note
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
ptnote current
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Displays the currently selected note.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
# Default Note Template
|
|
167
|
+
|
|
168
|
+
Every new note starts with the following template:
|
|
169
|
+
|
|
170
|
+
```text
|
|
171
|
+
Target:
|
|
172
|
+
Admin:
|
|
173
|
+
IP:
|
|
174
|
+
Domain:
|
|
175
|
+
====================
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
# Data Storage
|
|
181
|
+
|
|
182
|
+
PtNote stores all notes locally inside:
|
|
183
|
+
|
|
184
|
+
```text
|
|
185
|
+
~/.ptnote/
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Notes are stored locally, with each target having its own directory and note file.
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
# License
|
|
193
|
+
|
|
194
|
+
This project is licensed under the PolyForm Noncommercial License 1.0.0.
|
|
195
|
+
|
|
196
|
+
You may use, modify, and share PtNote for personal, educational, and non-commercial purposes.
|
|
197
|
+
|
|
198
|
+
Commercial use requires explicit permission from the author.
|
|
199
|
+
This project is licensed under the P # License
|
|
200
|
+
|
|
201
|
+
This project is licensed under the PolyForm Noncommercial License 1.0.0.
|
|
202
|
+
|
|
203
|
+
You may use, modify, and share PtNote for personal, educational, and non-commercial purposes.
|
|
204
|
+
|
|
205
|
+
Commercial use requires explicit permission from the author.
|
|
206
|
+
|
|
207
|
+
## Disclaimer
|
|
208
|
+
|
|
209
|
+
PtNote is intended for authorized security testing, CTF competitions, and educational purposes only.
|
ptnote-1.0.0/README.md
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# PtNote
|
|
2
|
+
|
|
3
|
+
**PtNote** is a lightweight terminal-based note manager designed for penetration testers and CTF players. It lets you quickly create, organize, and manage notes directly from the command line without leaving your workflow.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Create separate notes for each target
|
|
8
|
+
- Select an active note
|
|
9
|
+
- Add notes instantly
|
|
10
|
+
- Display note contents
|
|
11
|
+
- Clear a note while preserving the template
|
|
12
|
+
- List all available notes
|
|
13
|
+
- Set target information
|
|
14
|
+
- Admin
|
|
15
|
+
- IP Address
|
|
16
|
+
- Domain
|
|
17
|
+
- Rename existing notes
|
|
18
|
+
- Delete notes
|
|
19
|
+
- Show the currently selected note
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
# Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install ptnote
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
# Usage
|
|
32
|
+
|
|
33
|
+
## Create a new note
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
ptnote new target1
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Creates a new note using the default template.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Select a note
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
ptnote select target1
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Sets the selected note as the active note.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Add a note
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
ptnote add "Found SQL Injection on /login"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Appends a new line to the active note.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Show a note
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
ptnote show target1
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Displays the contents of the specified note.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Clear a note
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
ptnote clear target1
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Resets the note to the default template.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## List notes
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
ptnote list
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Lists all available notes.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Set target information
|
|
94
|
+
|
|
95
|
+
Set administrator:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
ptnote set admin administrator
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Set IP address:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
ptnote set ip 192.168.1.10
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Set domain:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
ptnote set domain example.com
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Rename a note
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
ptnote rename target1 target2
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Renames both the note folder and its file.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Delete a note
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
ptnote delete target2
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Deletes the specified note after confirmation.
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Show current active note
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
ptnote current
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Displays the currently selected note.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
# Default Note Template
|
|
146
|
+
|
|
147
|
+
Every new note starts with the following template:
|
|
148
|
+
|
|
149
|
+
```text
|
|
150
|
+
Target:
|
|
151
|
+
Admin:
|
|
152
|
+
IP:
|
|
153
|
+
Domain:
|
|
154
|
+
====================
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
# Data Storage
|
|
160
|
+
|
|
161
|
+
PtNote stores all notes locally inside:
|
|
162
|
+
|
|
163
|
+
```text
|
|
164
|
+
~/.ptnote/
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Notes are stored locally, with each target having its own directory and note file.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
# License
|
|
172
|
+
|
|
173
|
+
This project is licensed under the PolyForm Noncommercial License 1.0.0.
|
|
174
|
+
|
|
175
|
+
You may use, modify, and share PtNote for personal, educational, and non-commercial purposes.
|
|
176
|
+
|
|
177
|
+
Commercial use requires explicit permission from the author.
|
|
178
|
+
This project is licensed under the P # License
|
|
179
|
+
|
|
180
|
+
This project is licensed under the PolyForm Noncommercial License 1.0.0.
|
|
181
|
+
|
|
182
|
+
You may use, modify, and share PtNote for personal, educational, and non-commercial purposes.
|
|
183
|
+
|
|
184
|
+
Commercial use requires explicit permission from the author.
|
|
185
|
+
|
|
186
|
+
## Disclaimer
|
|
187
|
+
|
|
188
|
+
PtNote is intended for authorized security testing, CTF competitions, and educational purposes only.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.0.0"
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import argparse
|
|
3
|
+
import os
|
|
4
|
+
import json
|
|
5
|
+
from . import config_settings
|
|
6
|
+
from .config_settings import save_config
|
|
7
|
+
import shutil
|
|
8
|
+
|
|
9
|
+
CLEAR_NOTE = """Target:
|
|
10
|
+
Admin:
|
|
11
|
+
IP:
|
|
12
|
+
Domain:
|
|
13
|
+
====================
|
|
14
|
+
"""
|
|
15
|
+
FIELDS = {
|
|
16
|
+
"admin": "Admin:",
|
|
17
|
+
"ip": "IP:",
|
|
18
|
+
"domain": "Domain:"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
def update_field(file_path, field, value):
|
|
22
|
+
if os.path.exists(file_path):
|
|
23
|
+
with open(file_path, "r", encoding="utf-8") as file:
|
|
24
|
+
lines = file.readlines()
|
|
25
|
+
for i, line in enumerate(lines):
|
|
26
|
+
if line.startswith(field):
|
|
27
|
+
lines[i] = f"{field} {value}\n"
|
|
28
|
+
with open(file_path, "w", encoding="utf-8") as file:
|
|
29
|
+
file.writelines(lines)
|
|
30
|
+
return True
|
|
31
|
+
return False
|
|
32
|
+
|
|
33
|
+
def main():
|
|
34
|
+
home = os.path.expanduser("~")
|
|
35
|
+
filelocation = os.path.join(home, ".ptnote", "notes")
|
|
36
|
+
parser = argparse.ArgumentParser()
|
|
37
|
+
subparsers = parser.add_subparsers(dest="command")
|
|
38
|
+
|
|
39
|
+
new_parser = subparsers.add_parser("new")
|
|
40
|
+
new_parser.add_argument("name")
|
|
41
|
+
|
|
42
|
+
clear_parser = subparsers.add_parser("clear")
|
|
43
|
+
clear_parser.add_argument("name")
|
|
44
|
+
|
|
45
|
+
select = subparsers.add_parser("select")
|
|
46
|
+
select.add_argument("selected_note")
|
|
47
|
+
|
|
48
|
+
show = subparsers.add_parser("show")
|
|
49
|
+
show.add_argument("show_note")
|
|
50
|
+
|
|
51
|
+
delete = subparsers.add_parser("delete")
|
|
52
|
+
delete.add_argument("delete_selected_note")
|
|
53
|
+
|
|
54
|
+
add_note = subparsers.add_parser("add")
|
|
55
|
+
add_note.add_argument("note")
|
|
56
|
+
|
|
57
|
+
list_all_notes = subparsers.add_parser("list")
|
|
58
|
+
|
|
59
|
+
set_parser = subparsers.add_parser("set")
|
|
60
|
+
set_parser.add_argument("field")
|
|
61
|
+
set_parser.add_argument("value")
|
|
62
|
+
|
|
63
|
+
rename = subparsers.add_parser("rename")
|
|
64
|
+
rename.add_argument("old_note_name")
|
|
65
|
+
rename.add_argument("new_note_name")
|
|
66
|
+
|
|
67
|
+
current = subparsers.add_parser("current")
|
|
68
|
+
|
|
69
|
+
args = parser.parse_args()
|
|
70
|
+
|
|
71
|
+
if args.command == "new":
|
|
72
|
+
os.makedirs(filelocation, exist_ok=True)
|
|
73
|
+
os.makedirs(os.path.join(filelocation, args.name), exist_ok=True)
|
|
74
|
+
file = os.path.join(filelocation, args.name, f"{args.name}.txt")
|
|
75
|
+
with open(file, "a", encoding="utf-8") as new_file:
|
|
76
|
+
new_file.write(CLEAR_NOTE)
|
|
77
|
+
print(f"New note is created: {file}")
|
|
78
|
+
|
|
79
|
+
elif args.command == "clear":
|
|
80
|
+
file = os.path.join(filelocation, args.name, f"{args.name}.txt")
|
|
81
|
+
if os.path.exists(file):
|
|
82
|
+
with open(file, "w", encoding="utf-8") as clear_file:
|
|
83
|
+
clear_file.write(CLEAR_NOTE)
|
|
84
|
+
else:
|
|
85
|
+
print('Error: Unknown file name')
|
|
86
|
+
|
|
87
|
+
elif args.command == "select":
|
|
88
|
+
file = os.path.join(filelocation, args.selected_note, f"{args.selected_note}.txt")
|
|
89
|
+
if os.path.exists(file):
|
|
90
|
+
config = config_settings.load_config()
|
|
91
|
+
config['active_note'] = args.selected_note
|
|
92
|
+
config_settings.save_config(config)
|
|
93
|
+
print(f"Active note changed: {args.selected_note}")
|
|
94
|
+
else:
|
|
95
|
+
print("Error: Unknown file name")
|
|
96
|
+
|
|
97
|
+
elif args.command == "set":
|
|
98
|
+
if args.field not in FIELDS:
|
|
99
|
+
print("Error: Unknown field")
|
|
100
|
+
return
|
|
101
|
+
config = config_settings.load_config()
|
|
102
|
+
active_note = config["active_note"]
|
|
103
|
+
|
|
104
|
+
if active_note:
|
|
105
|
+
file_path = os.path.join(
|
|
106
|
+
filelocation,
|
|
107
|
+
active_note,
|
|
108
|
+
f"{active_note}.txt"
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
result = update_field(
|
|
112
|
+
file_path,
|
|
113
|
+
FIELDS[args.field],
|
|
114
|
+
args.value
|
|
115
|
+
)
|
|
116
|
+
if result:
|
|
117
|
+
print(f"{FIELDS[args.field]} {args.value}")
|
|
118
|
+
else:
|
|
119
|
+
print("Error: Field not found")
|
|
120
|
+
else:
|
|
121
|
+
print("Error: No active note selected")
|
|
122
|
+
|
|
123
|
+
elif args.command == "show":
|
|
124
|
+
file = os.path.join(filelocation, args.show_note, f"{args.show_note}.txt")
|
|
125
|
+
if os.path.exists(file):
|
|
126
|
+
with open(file, "r", encoding="utf-8") as show_file:
|
|
127
|
+
content = show_file.read()
|
|
128
|
+
print(content)
|
|
129
|
+
else:
|
|
130
|
+
print("Error: Unknown file name")
|
|
131
|
+
|
|
132
|
+
elif args.command == "list":
|
|
133
|
+
note = os.listdir(filelocation)
|
|
134
|
+
print(note)
|
|
135
|
+
|
|
136
|
+
elif args.command == "delete":
|
|
137
|
+
path = os.path.join(filelocation, args.delete_selected_note)
|
|
138
|
+
config = config_settings.load_config()
|
|
139
|
+
if args.delete_selected_note == config["active_note"]:
|
|
140
|
+
if os.path.exists(path):
|
|
141
|
+
yesOrNo = input("Are you sure you want to delete this note? (y/N): ")
|
|
142
|
+
if yesOrNo == "y" or yesOrNo == "Y":
|
|
143
|
+
shutil.rmtree(path)
|
|
144
|
+
config["active_note"] = None
|
|
145
|
+
config_settings.save_config(config)
|
|
146
|
+
print(f"Deleted selected note: {args.delete_selected_note}")
|
|
147
|
+
else:
|
|
148
|
+
print("transaction canceled")
|
|
149
|
+
else:
|
|
150
|
+
print("Error: Unknown file name")
|
|
151
|
+
elif args.delete_selected_note != config["active_note"]:
|
|
152
|
+
if os.path.exists(path):
|
|
153
|
+
yesOrNo = input("Are you sure you want to delete this note? (y/N): ")
|
|
154
|
+
if yesOrNo == "y" or yesOrNo == "Y":
|
|
155
|
+
shutil.rmtree(path)
|
|
156
|
+
print(f"Deleted selected note: {args.delete_selected_note}")
|
|
157
|
+
else:
|
|
158
|
+
print("transaction canceled")
|
|
159
|
+
else:
|
|
160
|
+
print("Error: Unknown file name")
|
|
161
|
+
|
|
162
|
+
elif args.command == "add":
|
|
163
|
+
config = config_settings.load_config()
|
|
164
|
+
if config["active_note"] != None:
|
|
165
|
+
note = os.path.join(filelocation, config["active_note"], f"{config['active_note']}.txt")
|
|
166
|
+
with open(note, "a", encoding="utf-8") as new_file:
|
|
167
|
+
new_file.write(args.note + "\n")
|
|
168
|
+
print("Note added")
|
|
169
|
+
else:
|
|
170
|
+
print("Error: No active note selected")
|
|
171
|
+
|
|
172
|
+
elif args.command == "rename":
|
|
173
|
+
old_folder = os.path.join(
|
|
174
|
+
filelocation,
|
|
175
|
+
args.old_note_name
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
new_folder = os.path.join(filelocation, args.new_note_name)
|
|
179
|
+
if os.path.exists(old_folder):
|
|
180
|
+
os.rename(old_folder, new_folder)
|
|
181
|
+
old_file = os.path.join(new_folder, f"{args.old_note_name}.txt")
|
|
182
|
+
new_file = os.path.join(new_folder, f"{args.new_note_name}.txt")
|
|
183
|
+
|
|
184
|
+
os.rename(old_file, new_file)
|
|
185
|
+
|
|
186
|
+
config = config_settings.load_config()
|
|
187
|
+
if config["active_note"] == args.old_note_name:
|
|
188
|
+
config["active_note"] = args.new_note_name
|
|
189
|
+
|
|
190
|
+
config_settings.save_config(config)
|
|
191
|
+
print(
|
|
192
|
+
f"Renamed {args.old_note_name} -> {args.new_note_name}"
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
else:
|
|
196
|
+
print("Error: Unknown note")
|
|
197
|
+
|
|
198
|
+
elif args.command == "current":
|
|
199
|
+
config = config_settings.load_config()
|
|
200
|
+
if config["active_note"] != None:
|
|
201
|
+
print("Current File: " + config["active_note"])
|
|
202
|
+
else:
|
|
203
|
+
print("No active notes")
|
|
204
|
+
if __name__ == "__main__":
|
|
205
|
+
main()
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
PTNOTE_DIR = os.path.join(os.path.expanduser("~"), ".ptnote")
|
|
5
|
+
CONFIG_FILE = os.path.join(PTNOTE_DIR, "config.json")
|
|
6
|
+
|
|
7
|
+
def load_config():
|
|
8
|
+
os.makedirs(PTNOTE_DIR, exist_ok=True)
|
|
9
|
+
if os.path.exists(CONFIG_FILE):
|
|
10
|
+
with open(CONFIG_FILE, "r", encoding="utf-8") as file:
|
|
11
|
+
return json.load(file)
|
|
12
|
+
|
|
13
|
+
config = {
|
|
14
|
+
"active_note": None
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
save_config(config)
|
|
18
|
+
return config
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def save_config(config):
|
|
22
|
+
with open(CONFIG_FILE, "w", encoding="utf-8") as file:
|
|
23
|
+
json.dump(config, file, indent=4)
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ptnote
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A fast terminal note manager for penetration testers.
|
|
5
|
+
Author: Salih
|
|
6
|
+
License: ## License
|
|
7
|
+
|
|
8
|
+
PtNote is licensed under the PolyForm Noncommercial License 1.0.0.
|
|
9
|
+
|
|
10
|
+
You may use, modify, and share PtNote for personal, educational, and non-commercial purposes.
|
|
11
|
+
|
|
12
|
+
Commercial use requires explicit permission from the author.
|
|
13
|
+
Keywords: pentest,ctf,notes,security,terminal
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Environment :: Console
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# PtNote
|
|
23
|
+
|
|
24
|
+
**PtNote** is a lightweight terminal-based note manager designed for penetration testers and CTF players. It lets you quickly create, organize, and manage notes directly from the command line without leaving your workflow.
|
|
25
|
+
|
|
26
|
+
## Features
|
|
27
|
+
|
|
28
|
+
- Create separate notes for each target
|
|
29
|
+
- Select an active note
|
|
30
|
+
- Add notes instantly
|
|
31
|
+
- Display note contents
|
|
32
|
+
- Clear a note while preserving the template
|
|
33
|
+
- List all available notes
|
|
34
|
+
- Set target information
|
|
35
|
+
- Admin
|
|
36
|
+
- IP Address
|
|
37
|
+
- Domain
|
|
38
|
+
- Rename existing notes
|
|
39
|
+
- Delete notes
|
|
40
|
+
- Show the currently selected note
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
# Installation
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install ptnote
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
# Usage
|
|
53
|
+
|
|
54
|
+
## Create a new note
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
ptnote new target1
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Creates a new note using the default template.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Select a note
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
ptnote select target1
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Sets the selected note as the active note.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Add a note
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
ptnote add "Found SQL Injection on /login"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Appends a new line to the active note.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Show a note
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
ptnote show target1
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Displays the contents of the specified note.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Clear a note
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
ptnote clear target1
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Resets the note to the default template.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## List notes
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
ptnote list
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Lists all available notes.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Set target information
|
|
115
|
+
|
|
116
|
+
Set administrator:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
ptnote set admin administrator
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Set IP address:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
ptnote set ip 192.168.1.10
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Set domain:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
ptnote set domain example.com
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Rename a note
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
ptnote rename target1 target2
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Renames both the note folder and its file.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Delete a note
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
ptnote delete target2
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Deletes the specified note after confirmation.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Show current active note
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
ptnote current
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Displays the currently selected note.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
# Default Note Template
|
|
167
|
+
|
|
168
|
+
Every new note starts with the following template:
|
|
169
|
+
|
|
170
|
+
```text
|
|
171
|
+
Target:
|
|
172
|
+
Admin:
|
|
173
|
+
IP:
|
|
174
|
+
Domain:
|
|
175
|
+
====================
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
# Data Storage
|
|
181
|
+
|
|
182
|
+
PtNote stores all notes locally inside:
|
|
183
|
+
|
|
184
|
+
```text
|
|
185
|
+
~/.ptnote/
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Notes are stored locally, with each target having its own directory and note file.
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
# License
|
|
193
|
+
|
|
194
|
+
This project is licensed under the PolyForm Noncommercial License 1.0.0.
|
|
195
|
+
|
|
196
|
+
You may use, modify, and share PtNote for personal, educational, and non-commercial purposes.
|
|
197
|
+
|
|
198
|
+
Commercial use requires explicit permission from the author.
|
|
199
|
+
This project is licensed under the P # License
|
|
200
|
+
|
|
201
|
+
This project is licensed under the PolyForm Noncommercial License 1.0.0.
|
|
202
|
+
|
|
203
|
+
You may use, modify, and share PtNote for personal, educational, and non-commercial purposes.
|
|
204
|
+
|
|
205
|
+
Commercial use requires explicit permission from the author.
|
|
206
|
+
|
|
207
|
+
## Disclaimer
|
|
208
|
+
|
|
209
|
+
PtNote is intended for authorized security testing, CTF competitions, and educational purposes only.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
ptnote/__init__.py
|
|
5
|
+
ptnote/cli.py
|
|
6
|
+
ptnote/config_settings.py
|
|
7
|
+
ptnote.egg-info/PKG-INFO
|
|
8
|
+
ptnote.egg-info/SOURCES.txt
|
|
9
|
+
ptnote.egg-info/dependency_links.txt
|
|
10
|
+
ptnote.egg-info/entry_points.txt
|
|
11
|
+
ptnote.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ptnote"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "A fast terminal note manager for penetration testers."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { file = "LICENSE" }
|
|
12
|
+
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "Salih" }
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
keywords = [
|
|
18
|
+
"pentest",
|
|
19
|
+
"ctf",
|
|
20
|
+
"notes",
|
|
21
|
+
"security",
|
|
22
|
+
"terminal"
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
classifiers = [
|
|
26
|
+
"Programming Language :: Python :: 3",
|
|
27
|
+
"Operating System :: OS Independent",
|
|
28
|
+
"Environment :: Console"
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
ptnote = "ptnote.cli:main"
|
|
33
|
+
|
|
34
|
+
[tool.setuptools.packages.find]
|
|
35
|
+
where = ["."]
|
ptnote-1.0.0/setup.cfg
ADDED