forked from OWASP-BLT/BLT-Lettuce
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
ffb9831
commit 3c4986a
Showing
12 changed files
with
1,304 additions
and
3 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,3 +1,4 @@ | ||
.env | ||
.ruff_cache | ||
*.code-workspace | ||
.secrets |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -1351,4 +1351,4 @@ | |
"OWASP Foundation web repository", | ||
"https://github.com/OWASP/www-project-pentest-best-practices" | ||
] | ||
} | ||
} |
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,20 @@ | ||
[tool.poetry] | ||
name = "lettucetoolkit" | ||
version = "0.1.0" | ||
description = "" | ||
authors = ["Sarthak5598 <[email protected]>"] | ||
readme = "README.md" | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.11" | ||
requests = "^2.32.3" | ||
python-dotenv = "^1.0.1" | ||
gitpython = "^3.1.43" | ||
slack-machine = "^0.37.0" | ||
slackeventsapi = "^3.0.1" | ||
slack-sdk = "^3.27.2" | ||
|
||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
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 |
---|---|---|
|
@@ -35,4 +35,4 @@ | |
"https://github.com/OWASP-BLT/BLT" | ||
] | ||
} | ||
|
||
|
Empty file.
Empty file.
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,28 @@ | ||
import json | ||
|
||
import requests | ||
from machine.plugins.base import MachineBasePlugin | ||
from machine.plugins.decorators import command | ||
|
||
project_json_path = "/home/DonnieBLT/BLT-Lettuce/projects.json" | ||
with open(project_json_path) as f: | ||
project_data = json.load(f) | ||
|
||
|
||
class ProjectPlugin(MachineBasePlugin): | ||
@command("/project") | ||
async def project(self, command): | ||
data = requests.form | ||
text = data.get("text") | ||
user_name = data.get("user_name") | ||
project_name = text.strip().lower() | ||
|
||
project = project_data.get(project_name) | ||
|
||
if project: | ||
project_list = "\n".join(project) | ||
message = f"Hello {user_name}, here the information about '{project_name}':\n{project_list}" | ||
else: | ||
message = f"Hello {user_name}, the project '{project_name}' is not recognized. Please try different query." | ||
|
||
command.say(message) |
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,28 @@ | ||
import json | ||
|
||
import requests | ||
from machine.plugins.base import MachineBasePlugin | ||
from machine.plugins.decorators import command | ||
|
||
repo_json_path = "/home/DonnieBLT/BLT-Lettuce/repo.json" | ||
with open(repo_json_path) as f: | ||
repos_data = json.load(f) | ||
|
||
|
||
class RepoPlugin(MachineBasePlugin): | ||
@command("/project") | ||
async def project(self, command): | ||
data = requests.form | ||
text = data.get("text") | ||
user_name = data.get("user_name") | ||
tech_name = text.strip().lower() | ||
|
||
repos = repos_data.get(tech_name) | ||
|
||
if repos: | ||
repos_list = "\n".join(repos) | ||
message = f"Hello {user_name}, you can implement your '{tech_name}' knowledge here:\n{repos_list}" | ||
else: | ||
message = f"Hello {user_name}, the technology '{tech_name}' is not recognized. Please try again." | ||
|
||
command.say(message) |
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,11 @@ | ||
from dotenv import dotenv_values | ||
|
||
secrets = dotenv_values(".secrets") | ||
|
||
SLACK_APP_TOKEN = secrets.get("SLACK_APP_TOKEN") | ||
SLACK_BOT_TOKEN = secrets.get("SLACK_BOT_TOKEN") | ||
|
||
PLUGINS = ( | ||
"lettuce.plugins.project.ProjectPlugin", | ||
"lettuce.plugins.repo.RepoPlugin", | ||
) |