This repository has been archived by the owner on Jan 29, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
119 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Changelog | ||
# **Changelog** | ||
## [Stable-Release] | ||
|
||
## v1.0.1 - 19-10-2024 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# License | ||
# **License** | ||
|
||
The project works by highlighting and improving security measures by demonstrating potential vulnerabilities when the system is connected with pip. It is licensed under the [GPL 3.0](https://www.gnu.org/licenses/gpl-3.0.en.html), allowing you to sneakily use and modify it as needed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import os | ||
from package.offline.support import copy_to_clipboard | ||
from package.offline.support import display | ||
|
||
|
||
def clip(snippet_name, password): | ||
display(snippet_name, password, action="copy") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import os | ||
from package.offline.support import list_snippets, display | ||
from package.password import valid_password | ||
|
||
|
||
def show(snippet_name=None, password=None): | ||
if snippet_name is None and password is None: | ||
base_dir = os.path.dirname(__file__) | ||
snippets_dir = os.path.join(base_dir, "stash") | ||
list_snippets(snippets_dir) | ||
return | ||
|
||
display(snippet_name, password, action="display") |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import subprocess | ||
import sys | ||
import shutil | ||
|
||
|
||
def copy_to_clipboard(text): | ||
try: | ||
if "linux" in sys.platform: | ||
if shutil.which("xclip") is None: | ||
raise RuntimeError("xclip not found. Install it.") | ||
subprocess.run( | ||
["xclip", "-selection", "clipboard"], | ||
input=text.strip().encode(), | ||
check=True, | ||
) | ||
|
||
elif "win32" in sys.platform: | ||
subprocess.run( | ||
["C:\\Windows\\System32\\clip.exe"], | ||
input=text.strip().encode(), | ||
check=True, | ||
) | ||
|
||
elif "darwin" in sys.platform: | ||
subprocess.run(["/usr/bin/pbcopy"], input=text.strip().encode(), check=True) | ||
|
||
else: | ||
raise OSError("Unsupported operating system") | ||
except subprocess.CalledProcessError: | ||
print("Error: Failed to copy to clipboard.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import os | ||
from package.offline.support import copy_to_clipboard | ||
from package.password import valid_password | ||
|
||
|
||
def display(snippet_name, password, action): | ||
if not isinstance(password, int) or not valid_password(password): | ||
raise ValueError("Incorrect password") | ||
|
||
base_dir = os.path.dirname(__file__) | ||
snippets_dir = os.path.join(base_dir, "stash") | ||
|
||
try: | ||
snippet_path = os.path.join(snippets_dir, snippet_name) | ||
with open(snippet_path, "r") as file: | ||
content = file.read() | ||
|
||
if action == "display": | ||
print(content) | ||
elif action == "copy": | ||
copy_to_clipboard(content) | ||
print("Snippet copied to clipboard.") | ||
except FileNotFoundError: | ||
print("Error: No file found with the specified name.") | ||
except Exception as e: | ||
print(f"Error: {e}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import os | ||
|
||
|
||
def list_snippets(snippets_dir): | ||
try: | ||
contents = os.listdir(snippets_dir) | ||
for file in contents: | ||
print(file) | ||
except FileNotFoundError: | ||
print("Error: Stash directory not found.") | ||
except Exception as e: | ||
print(f"Error: {e}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import shutil | ||
import os | ||
from package.password import valid_password | ||
|
||
|
||
def write(snippet_name, password): | ||
if not isinstance(password, int) or not valid_password(password): | ||
raise ValueError("Incorrect password") | ||
|
||
base_dir = os.path.dirname(__file__) | ||
snippets_dir = os.path.join(base_dir, "stash") | ||
|
||
try: | ||
snippet_path = os.path.join(snippets_dir, snippet_name) | ||
output_path = os.path.join(base_dir, snippet_name) | ||
|
||
shutil.copyfile(snippet_path, output_path) | ||
print(f"File '{snippet_path}' copied successfully to '{output_path}'.") | ||
except FileNotFoundError: | ||
print("Error: No file found with the specified name.") | ||
except Exception as e: | ||
print(f"Error: {e}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from datetime import datetime | ||
|
||
|
||
def valid_password(password: int) -> bool: | ||
current_time = int(datetime.now().strftime("%H%M")) | ||
return password == current_time |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.