linise 0.1.0__py3-none-any.whl
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.
- linise/__init__.py +0 -0
- linise/app.py +331 -0
- linise/profiles/generic.json +10 -0
- linise/profiles/kali.json +40 -0
- linise/profiles/parrot.json +10 -0
- linise-0.1.0.dist-info/METADATA +31 -0
- linise-0.1.0.dist-info/RECORD +11 -0
- linise-0.1.0.dist-info/WHEEL +5 -0
- linise-0.1.0.dist-info/entry_points.txt +2 -0
- linise-0.1.0.dist-info/licenses/LICENSE +21 -0
- linise-0.1.0.dist-info/top_level.txt +1 -0
linise/__init__.py
ADDED
|
File without changes
|
linise/app.py
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
import re
|
|
4
|
+
import subprocess
|
|
5
|
+
import urllib.request
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from textual import work
|
|
8
|
+
from textual.app import App, ComposeResult
|
|
9
|
+
from textual.containers import Horizontal, Vertical, VerticalScroll
|
|
10
|
+
from textual.widgets import (
|
|
11
|
+
Header, Footer, Input, ListView, ListItem, Label,
|
|
12
|
+
Static, Button, Checkbox, Select, TabbedContent, TabPane, TextArea
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
PROFILE_DIR = Path(__file__).parent / "profiles"
|
|
16
|
+
CONFIG_FILE = Path.home() / ".linise_config.json"
|
|
17
|
+
|
|
18
|
+
GUIDED_MISSIONS = {
|
|
19
|
+
"none": {"label": "Choose a beginner step-by-step walkthrough...", "cmd": "", "guide": "Pick a mission above to see a plain-English breakdown of every step and flag."},
|
|
20
|
+
"recon_hosts": {"label": "1. Network Recon: Find live devices on my Wi-Fi/LAN", "cmd": "nmap -sn 192.168.1.0/24", "guide": "[b]Goal:[/b] Discover active devices on your local subnet without scanning ports.\n\n[b]Step 1:[/b] [cyan]nmap[/cyan] — Industry-standard network scanner.\n[b]Step 2:[/b] [green]-sn[/green] — Ping Scan mode (checks live hosts only).\n[b]Step 3:[/b] [yellow]192.168.1.0/24[/yellow] — Scans .1 through .254."},
|
|
21
|
+
"web_dirs": {"label": "2. Web Audit: Find hidden folders on a website", "cmd": "gobuster dir -u http://testphp.vulnweb.com -w /usr/share/wordlists/dirb/common.txt", "guide": "[b]Goal:[/b] Discover hidden directories like /admin on a web server.\n\n[b]Step 1:[/b] [cyan]gobuster dir[/cyan] — Directory brute-force mode.\n[b]Step 2:[/b] [green]-u http://...[/green] — Target URL.\n[b]Step 3:[/b] [yellow]-w /usr/share/wordlists/...[/yellow] — Common folder wordlist."},
|
|
22
|
+
"find_files": {"label": "3. Linux Basics: Find recently modified config files", "cmd": "find /etc -name '*.conf' -mtime -7 2>/dev/null", "guide": "[b]Goal:[/b] Locate .conf files modified in the last 7 days.\n\n[b]Step 1:[/b] [cyan]find /etc[/cyan] — Search inside /etc.\n[b]Step 2:[/b] [green]-name '*.conf' -mtime -7[/green] — Filter by extension and age.\n[b]Step 3:[/b] [yellow]2>/dev/null[/yellow] — Hide 'Permission denied' noise."},
|
|
23
|
+
"sys_ports": {"label": "4. Troubleshooting: Check open network ports", "cmd": "ss -tulnp", "guide": "[b]Goal:[/b] List all listening TCP/UDP ports and their programs.\n\n[b]Flags:[/b] [green]-t[/green] (TCP), [green]-u[/green] (UDP), [green]-l[/green] (Listening), [green]-n[/green] (Numeric ports), [green]-p[/green] (Process name)."}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
def detect_distro_profile():
|
|
27
|
+
distro_key = "generic"
|
|
28
|
+
try:
|
|
29
|
+
content = Path("/etc/os-release").read_text(encoding="utf-8").lower()
|
|
30
|
+
if "kali" in content:
|
|
31
|
+
distro_key = "kali"
|
|
32
|
+
elif "parrot" in content:
|
|
33
|
+
distro_key = "parrot"
|
|
34
|
+
except FileNotFoundError:
|
|
35
|
+
pass
|
|
36
|
+
return json.loads((PROFILE_DIR / f"{distro_key}.json").read_text(encoding="utf-8"))
|
|
37
|
+
|
|
38
|
+
def get_installed_commands():
|
|
39
|
+
commands = set()
|
|
40
|
+
for path_dir in os.environ.get("PATH", "").split(":"):
|
|
41
|
+
if path_dir.startswith("/mnt/") or not os.path.isdir(path_dir):
|
|
42
|
+
continue
|
|
43
|
+
try:
|
|
44
|
+
for item in os.listdir(path_dir):
|
|
45
|
+
full_path = os.path.join(path_dir, item)
|
|
46
|
+
if os.access(full_path, os.X_OK) and not os.path.isdir(full_path):
|
|
47
|
+
commands.add(item)
|
|
48
|
+
except PermissionError:
|
|
49
|
+
continue
|
|
50
|
+
return sorted(commands)
|
|
51
|
+
|
|
52
|
+
def parse_help_flags(cmd):
|
|
53
|
+
flags = []
|
|
54
|
+
try:
|
|
55
|
+
res = subprocess.run([cmd, "--help"], capture_output=True, text=True, timeout=2)
|
|
56
|
+
text = res.stdout or res.stderr or ""
|
|
57
|
+
pattern = re.compile(r"^\s*(-\w(?:,\s*--[\w-]+)?|--[\w-]+)\s+(.+)$", re.MULTILINE)
|
|
58
|
+
seen = set()
|
|
59
|
+
for match in pattern.finditer(text):
|
|
60
|
+
flag_token = match.group(1).split(",")[0].strip()
|
|
61
|
+
desc = match.group(2).strip()[:75]
|
|
62
|
+
if flag_token not in seen and len(flag_token) <= 20:
|
|
63
|
+
seen.add(flag_token)
|
|
64
|
+
flags.append({"flag": flag_token, "desc": desc})
|
|
65
|
+
if len(flags) >= 20:
|
|
66
|
+
break
|
|
67
|
+
except Exception:
|
|
68
|
+
pass
|
|
69
|
+
return flags
|
|
70
|
+
class LinISE(App):
|
|
71
|
+
CSS = """
|
|
72
|
+
Screen { background: #0d1117; color: #e6edf3; }
|
|
73
|
+
Header { background: #161b22; color: #58a6ff; text-style: bold; border-bottom: tall #30363d; }
|
|
74
|
+
Footer { background: #161b22; color: #8b949e; }
|
|
75
|
+
#top-workspace { height: 1fr; margin: 1 1 0 1; }
|
|
76
|
+
#sidebar { width: 36; background: #161b22; border: round #30363d; border-title-color: #58a6ff; border-title-style: bold; padding: 1; margin-right: 1; }
|
|
77
|
+
#sidebar:focus-within { border: round #58a6ff; }
|
|
78
|
+
#right-panel { width: 1fr; background: #161b22; border: round #30363d; border-title-color: #3fb950; border-title-style: bold; padding: 0 1; }
|
|
79
|
+
#right-panel:focus-within { border: round #3fb950; }
|
|
80
|
+
Select, Input { margin-bottom: 1; }
|
|
81
|
+
Input { background: #0d1117; border: round #30363d; color: #e6edf3; padding: 0 1; }
|
|
82
|
+
Input:focus { border: round #58a6ff; }
|
|
83
|
+
ListView { background: #0d1117; border: round #21262d; padding: 0 1; }
|
|
84
|
+
ListItem { padding: 0 1; }
|
|
85
|
+
ListItem.--highlight { background: #1f6feb; color: #ffffff; text-style: bold; }
|
|
86
|
+
#flag-scroll, #doc-scroll, #ai-scroll { padding: 1; height: 1fr; }
|
|
87
|
+
.section-title { text-style: bold; margin-bottom: 1; color: #79c0ff; }
|
|
88
|
+
Checkbox { background: #0d1117; border: round #21262d; margin-bottom: 1; padding: 0 1; width: 1fr; }
|
|
89
|
+
Checkbox:hover { border: round #388bfd; }
|
|
90
|
+
Checkbox.-on { border: round #3fb950; background: #12261e; }
|
|
91
|
+
TextArea { background: #0d1117; border: round #30363d; height: 1fr; margin: 1 0; }
|
|
92
|
+
#script-actions, #ai-actions, #action-row { height: 3; align: left middle; }
|
|
93
|
+
#ai-explanation { background: #0d1117; border: round #30363d; padding: 1; margin-top: 1; color: #e6edf3; }
|
|
94
|
+
#builder-dock { height: auto; background: #161b22; border: round #d29922; border-title-color: #e3b341; border-title-style: bold; margin: 1; padding: 1; }
|
|
95
|
+
#cmd-input { border: round #d29922; color: #ffa657; text-style: bold; margin-bottom: 0; }
|
|
96
|
+
Button { margin-right: 1; min-width: 18; }
|
|
97
|
+
#cmd-output { height: 8; background: #010409; border: round #30363d; color: #3fb950; padding: 1; margin-top: 1; overflow-y: auto; }
|
|
98
|
+
"""
|
|
99
|
+
BINDINGS = [("ctrl+q", "quit", "Quit"), ("ctrl+r", "run_cmd", "Run Command")]
|
|
100
|
+
|
|
101
|
+
def __init__(self):
|
|
102
|
+
super().__init__()
|
|
103
|
+
self.profile = detect_distro_profile()
|
|
104
|
+
self.title = f"LinISE — {self.profile['distro_name']} Edition"
|
|
105
|
+
self.all_commands = get_installed_commands()
|
|
106
|
+
self.current_cmd = ""
|
|
107
|
+
self.selected_flags = []
|
|
108
|
+
self.current_category = "ALL"
|
|
109
|
+
|
|
110
|
+
def compose(self) -> ComposeResult:
|
|
111
|
+
yield Header(show_clock=True)
|
|
112
|
+
categories = [("All Installed Commands", "ALL")] + [(c, c) for c in self.profile.get("categories", {}).keys()]
|
|
113
|
+
with Horizontal(id="top-workspace"):
|
|
114
|
+
with Vertical(id="sidebar"):
|
|
115
|
+
yield Select(categories, value="ALL", id="category-select")
|
|
116
|
+
yield Input(placeholder="Filter commands...", id="search-box")
|
|
117
|
+
yield ListView(id="cmd-list")
|
|
118
|
+
with Vertical(id="right-panel"):
|
|
119
|
+
with TabbedContent():
|
|
120
|
+
with TabPane("Visual Flag Builder", id="tab-flags"):
|
|
121
|
+
with VerticalScroll(id="flag-scroll"):
|
|
122
|
+
yield Static("Select a command on the left to load its visual flag builder.", id="flag-header", classes="section-title")
|
|
123
|
+
yield Input(placeholder="Target / Arguments...", id="target-input")
|
|
124
|
+
yield Vertical(id="checkbox-container")
|
|
125
|
+
with TabPane("✨ AI Co-Pilot & Wizard", id="tab-ai"):
|
|
126
|
+
with VerticalScroll(id="ai-scroll"):
|
|
127
|
+
yield Static("Step-by-Step Beginner Missions (Built-In)", classes="section-title")
|
|
128
|
+
yield Select([(v["label"], k) for k, v in GUIDED_MISSIONS.items()], value="none", id="mission-select")
|
|
129
|
+
yield Static("AI Plain-English Command Generator (Gemini API)", classes="section-title")
|
|
130
|
+
yield Input(placeholder="Paste Gemini API Key (saved to ~/.linise_config.json)...", password=True, id="api-key-input")
|
|
131
|
+
yield Input(placeholder="Ask in plain English (e.g. 'scan 10.10.10.5 for open SSH and HTTP ports')...", id="ai-prompt-input")
|
|
132
|
+
with Horizontal(id="ai-actions"):
|
|
133
|
+
yield Button("✨ Generate & Explain", id="ai-gen-btn", variant="success")
|
|
134
|
+
yield Button("Save API Key", id="save-key-btn", variant="default")
|
|
135
|
+
yield Static(GUIDED_MISSIONS["none"]["guide"], id="ai-explanation")
|
|
136
|
+
with TabPane("Script Editor (.sh)", id="tab-script"):
|
|
137
|
+
yield TextArea("#!/bin/bash\n# Build commands visually and click '+ Append to Script'\n", language="bash", id="script-editor")
|
|
138
|
+
with Horizontal(id="script-actions"):
|
|
139
|
+
yield Button("▶ Run Script", id="run-script-btn", variant="success")
|
|
140
|
+
yield Button("Save as linise_script.sh", id="save-script-btn", variant="primary")
|
|
141
|
+
with TabPane("Quick Docs (TLDR)", id="tab-docs"):
|
|
142
|
+
with VerticalScroll(id="doc-scroll"):
|
|
143
|
+
yield Static("Command documentation will appear here.", id="doc-view")
|
|
144
|
+
with Vertical(id="builder-dock"):
|
|
145
|
+
yield Input(placeholder="Live assembled command...", id="cmd-input")
|
|
146
|
+
with Horizontal(id="action-row"):
|
|
147
|
+
yield Button("▶ Run Command (Ctrl+R)", id="run-btn", variant="success")
|
|
148
|
+
yield Button("Clear Flags", id="clear-btn", variant="warning")
|
|
149
|
+
yield Button("+ Append to Script", id="append-script-btn", variant="primary")
|
|
150
|
+
yield Button("↗ Interactive Shell", id="interactive-btn", variant="default")
|
|
151
|
+
yield Static("Terminal output ready...", id="cmd-output")
|
|
152
|
+
yield Footer()
|
|
153
|
+
|
|
154
|
+
def on_mount(self) -> None:
|
|
155
|
+
self.query_one("#sidebar").border_title = "⚡ COMMAND EXPLORER"
|
|
156
|
+
self.query_one("#right-panel").border_title = "🛠 WORKSPACE & INSPECTOR"
|
|
157
|
+
self.query_one("#builder-dock").border_title = "🚀 LIVE COMMAND CONSOLE"
|
|
158
|
+
if CONFIG_FILE.exists():
|
|
159
|
+
try:
|
|
160
|
+
self.query_one("#api-key-input", Input).value = json.loads(CONFIG_FILE.read_text()).get("gemini_api_key", "")
|
|
161
|
+
except Exception:
|
|
162
|
+
pass
|
|
163
|
+
self.refresh_command_list()
|
|
164
|
+
|
|
165
|
+
def refresh_command_list(self) -> None:
|
|
166
|
+
query = self.query_one("#search-box", Input).value.lower()
|
|
167
|
+
pool = self.all_commands if self.current_category == "ALL" else self.profile["categories"].get(self.current_category, [])
|
|
168
|
+
filtered = [c for c in pool if query in c.lower()][:250]
|
|
169
|
+
list_view = self.query_one("#cmd-list", ListView)
|
|
170
|
+
list_view.clear()
|
|
171
|
+
for cmd in filtered:
|
|
172
|
+
list_view.append(ListItem(Label(cmd), name=cmd))
|
|
173
|
+
|
|
174
|
+
def on_select_changed(self, event: Select.Changed) -> None:
|
|
175
|
+
if event.select.id == "category-select":
|
|
176
|
+
self.current_category = str(event.value)
|
|
177
|
+
self.refresh_command_list()
|
|
178
|
+
elif event.select.id == "mission-select":
|
|
179
|
+
mission = GUIDED_MISSIONS.get(str(event.value), GUIDED_MISSIONS["none"])
|
|
180
|
+
self.query_one("#ai-explanation", Static).update(mission["guide"])
|
|
181
|
+
if mission["cmd"]:
|
|
182
|
+
self.query_one("#cmd-input", Input).value = mission["cmd"]
|
|
183
|
+
|
|
184
|
+
def on_input_changed(self, event: Input.Changed) -> None:
|
|
185
|
+
if event.input.id == "search-box":
|
|
186
|
+
self.refresh_command_list()
|
|
187
|
+
elif event.input.id == "target-input":
|
|
188
|
+
self.rebuild_command_string()
|
|
189
|
+
|
|
190
|
+
def on_list_view_selected(self, event: ListView.Selected) -> None:
|
|
191
|
+
cmd = event.item.name
|
|
192
|
+
self.current_cmd = cmd
|
|
193
|
+
self.selected_flags = []
|
|
194
|
+
target_input = self.query_one("#target-input", Input)
|
|
195
|
+
target_input.value = ""
|
|
196
|
+
curated = self.profile.get("curated_flags", {}).get(cmd)
|
|
197
|
+
container = self.query_one("#checkbox-container", Vertical)
|
|
198
|
+
container.remove_children()
|
|
199
|
+
header = self.query_one("#flag-header", Static)
|
|
200
|
+
if curated:
|
|
201
|
+
header.update(f"Curated Builder: {cmd}")
|
|
202
|
+
target_input.placeholder = curated.get("target_label", "Target / Arguments...")
|
|
203
|
+
flags_data = curated.get("flags", [])
|
|
204
|
+
else:
|
|
205
|
+
header.update(f"Auto-Parsed Flags: {cmd}")
|
|
206
|
+
target_input.placeholder = f"Arguments or file path for {cmd}..."
|
|
207
|
+
flags_data = parse_help_flags(cmd)
|
|
208
|
+
if not flags_data:
|
|
209
|
+
container.mount(Static("No standard flags detected. Type arguments in the box above."))
|
|
210
|
+
else:
|
|
211
|
+
for item in flags_data:
|
|
212
|
+
container.mount(Checkbox(f"{item['flag']} — {item['desc']}", name=item["flag"]))
|
|
213
|
+
self.rebuild_command_string()
|
|
214
|
+
self.load_docs(cmd)
|
|
215
|
+
|
|
216
|
+
def on_checkbox_changed(self, event: Checkbox.Changed) -> None:
|
|
217
|
+
flag = event.checkbox.name
|
|
218
|
+
if event.value and flag not in self.selected_flags:
|
|
219
|
+
self.selected_flags.append(flag)
|
|
220
|
+
elif not event.value and flag in self.selected_flags:
|
|
221
|
+
self.selected_flags.remove(flag)
|
|
222
|
+
self.rebuild_command_string()
|
|
223
|
+
|
|
224
|
+
def rebuild_command_string(self) -> None:
|
|
225
|
+
if not self.current_cmd:
|
|
226
|
+
return
|
|
227
|
+
parts = [self.current_cmd] + self.selected_flags
|
|
228
|
+
target = self.query_one("#target-input", Input).value.strip()
|
|
229
|
+
if target:
|
|
230
|
+
parts.append(target)
|
|
231
|
+
full_cmd = " ".join(parts)
|
|
232
|
+
self.query_one("#cmd-input", Input).value = full_cmd
|
|
233
|
+
danger = any(x in full_cmd for x in ["rm -rf", "mkfs", "dd if=", "chmod 777", "> /dev/"])
|
|
234
|
+
dock = self.query_one("#builder-dock")
|
|
235
|
+
dock.border_title = "⚠️ CAUTION: DESTRUCTIVE COMMAND" if danger else "🚀 LIVE COMMAND CONSOLE"
|
|
236
|
+
|
|
237
|
+
def load_docs(self, cmd: str) -> None:
|
|
238
|
+
doc_view = self.query_one("#doc-view", Static)
|
|
239
|
+
try:
|
|
240
|
+
res = subprocess.run(["tldr", cmd], capture_output=True, text=True, timeout=2)
|
|
241
|
+
if res.returncode == 0 and res.stdout.strip():
|
|
242
|
+
doc_view.update(f"[b]TLDR Cheat Sheet: {cmd}[/b]\n\n{res.stdout}")
|
|
243
|
+
return
|
|
244
|
+
except Exception:
|
|
245
|
+
pass
|
|
246
|
+
try:
|
|
247
|
+
help_res = subprocess.run([cmd, "--help"], capture_output=True, text=True, timeout=2)
|
|
248
|
+
out = help_res.stdout or help_res.stderr or "No quick help available."
|
|
249
|
+
doc_view.update(f"[b]--help Output: {cmd}[/b]\n\n{out[:4000]}")
|
|
250
|
+
except Exception as e:
|
|
251
|
+
doc_view.update(f"Could not load help for {cmd}: {e}")
|
|
252
|
+
|
|
253
|
+
def action_run_cmd(self) -> None:
|
|
254
|
+
cmd_str = self.query_one("#cmd-input", Input).value.strip()
|
|
255
|
+
out_box = self.query_one("#cmd-output", Static)
|
|
256
|
+
if not cmd_str:
|
|
257
|
+
return
|
|
258
|
+
out_box.update(f"Running: {cmd_str} ...")
|
|
259
|
+
try:
|
|
260
|
+
res = subprocess.run(cmd_str, shell=True, capture_output=True, text=True, timeout=15)
|
|
261
|
+
out_box.update((res.stdout or res.stderr)[:5000] or "(Command finished with no output)")
|
|
262
|
+
except Exception as e:
|
|
263
|
+
out_box.update(f"Error: {e}")
|
|
264
|
+
|
|
265
|
+
def on_button_pressed(self, event: Button.Pressed) -> None:
|
|
266
|
+
bid = event.button.id
|
|
267
|
+
if bid == "run-btn":
|
|
268
|
+
self.action_run_cmd()
|
|
269
|
+
elif bid == "clear-btn":
|
|
270
|
+
self.selected_flags = []
|
|
271
|
+
for cb in self.query(Checkbox):
|
|
272
|
+
cb.value = False
|
|
273
|
+
self.query_one("#target-input", Input).value = ""
|
|
274
|
+
self.rebuild_command_string()
|
|
275
|
+
elif bid == "append-script-btn":
|
|
276
|
+
cmd_str = self.query_one("#cmd-input", Input).value.strip()
|
|
277
|
+
if cmd_str:
|
|
278
|
+
ed = self.query_one("#script-editor", TextArea)
|
|
279
|
+
ed.text = ed.text.rstrip() + "\n" + cmd_str + "\n"
|
|
280
|
+
self.query_one("#cmd-output", Static).update(f"Appended: {cmd_str}")
|
|
281
|
+
elif bid == "save-script-btn":
|
|
282
|
+
Path("linise_script.sh").write_text(self.query_one("#script-editor", TextArea).text)
|
|
283
|
+
os.chmod("linise_script.sh", 0o755)
|
|
284
|
+
self.query_one("#cmd-output", Static).update("Saved executable ./linise_script.sh")
|
|
285
|
+
elif bid == "run-script-btn":
|
|
286
|
+
Path("/tmp/linise_run.sh").write_text(self.query_one("#script-editor", TextArea).text)
|
|
287
|
+
res = subprocess.run(["bash", "/tmp/linise_run.sh"], capture_output=True, text=True, timeout=20)
|
|
288
|
+
self.query_one("#cmd-output", Static).update((res.stdout or res.stderr)[:5000] or "(Script finished)")
|
|
289
|
+
elif bid == "save-key-btn":
|
|
290
|
+
CONFIG_FILE.write_text(json.dumps({"gemini_api_key": self.query_one("#api-key-input", Input).value.strip()}))
|
|
291
|
+
self.query_one("#cmd-output", Static).update("API Key saved to ~/.linise_config.json")
|
|
292
|
+
elif bid == "interactive-btn":
|
|
293
|
+
cmd_str = self.query_one("#cmd-input", Input).value.strip()
|
|
294
|
+
if cmd_str:
|
|
295
|
+
with self.suspend():
|
|
296
|
+
os.system("clear")
|
|
297
|
+
print(f"[LinISE Interactive Shell] Running: {cmd_str}\n" + "-" * 50)
|
|
298
|
+
os.system(cmd_str)
|
|
299
|
+
input("\n[Press Enter to return to LinISE...]")
|
|
300
|
+
elif bid == "ai-gen-btn":
|
|
301
|
+
key = self.query_one("#api-key-input", Input).value.strip()
|
|
302
|
+
goal = self.query_one("#ai-prompt-input", Input).value.strip()
|
|
303
|
+
if not key or not goal:
|
|
304
|
+
self.query_one("#ai-explanation", Static).update("[bold red]Enter both an API key and a goal above, or use the Step-by-Step Missions dropdown.[/bold red]")
|
|
305
|
+
return
|
|
306
|
+
self.query_one("#ai-explanation", Static).update("⏳ Generating command & step-by-step guide...")
|
|
307
|
+
self.generate_ai_command(key, goal)
|
|
308
|
+
|
|
309
|
+
@work(thread=True)
|
|
310
|
+
def generate_ai_command(self, api_key: str, user_goal: str) -> None:
|
|
311
|
+
prompt = f"You are LinISE Co-Pilot on {self.profile.get('distro_name', 'Linux')}. Return ONLY JSON with 'command' and 'explanation' (step-by-step beginner guide)."
|
|
312
|
+
url = f"https://googleapis.com{api_key}"
|
|
313
|
+
payload = {"contents": [{"parts": [{"text": f"{prompt}\nGoal: {user_goal}"}]}], "generationConfig": {"responseMimeType": "application/json"}}
|
|
314
|
+
req = urllib.request.Request(url, data=json.dumps(payload).encode("utf-8"), headers={"Content-Type": "application/json"}, method="POST")
|
|
315
|
+
try:
|
|
316
|
+
with urllib.request.urlopen(req, timeout=15) as resp:
|
|
317
|
+
parsed = json.loads(json.loads(resp.read().decode("utf-8"))["candidates"][0]["content"]["parts"][0]["text"])
|
|
318
|
+
self.call_from_thread(self._apply_ai_result, parsed.get("command", "").strip(), parsed.get("explanation", ""))
|
|
319
|
+
except Exception as e:
|
|
320
|
+
self.call_from_thread(self.query_one("#ai-explanation", Static).update, f"[bold red]AI Error:[/bold red] {e}")
|
|
321
|
+
|
|
322
|
+
def _apply_ai_result(self, cmd: str, explanation: str) -> None:
|
|
323
|
+
if cmd:
|
|
324
|
+
self.query_one("#cmd-input", Input).value = cmd
|
|
325
|
+
self.query_one("#ai-explanation", Static).update(f"[bold green]Command:[/bold green] [bold yellow]{cmd}[/bold yellow]\n\n{explanation}")
|
|
326
|
+
|
|
327
|
+
def main():
|
|
328
|
+
LinISE().run()
|
|
329
|
+
|
|
330
|
+
if __name__ == "__main__":
|
|
331
|
+
main()
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"distro_name": "Standard Linux",
|
|
3
|
+
"accent_color": "yellow",
|
|
4
|
+
"categories": {
|
|
5
|
+
"Files & Search": ["ls", "find", "grep", "tar", "chmod", "chown", "rsync"],
|
|
6
|
+
"Networking": ["ip", "ss", "ping", "curl", "wget", "dig", "ssh"],
|
|
7
|
+
"System & Processes": ["ps", "top", "df", "du", "systemctl", "journalctl"]
|
|
8
|
+
},
|
|
9
|
+
"curated_flags": {}
|
|
10
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"distro_name": "Kali Linux",
|
|
3
|
+
"accent_color": "cyan",
|
|
4
|
+
"categories": {
|
|
5
|
+
"Recon & Scanning": ["nmap", "masscan", "netdiscover", "whois", "dig", "enum4linux"],
|
|
6
|
+
"Web & Fuzzing": ["gobuster", "ffuf", "nikto", "sqlmap", "whatweb", "curl"],
|
|
7
|
+
"Passwords & Cracking": ["hydra", "john", "hashcat", "crunch"],
|
|
8
|
+
"System & Files": ["grep", "find", "chmod", "tar", "ss", "ps"]
|
|
9
|
+
},
|
|
10
|
+
"curated_flags": {
|
|
11
|
+
"nmap": {
|
|
12
|
+
"target_label": "Target IP / Subnet (e.g. 192.168.1.1)",
|
|
13
|
+
"flags": [
|
|
14
|
+
{"flag": "-sV", "desc": "Probe open ports to determine service/version info"},
|
|
15
|
+
{"flag": "-sC", "desc": "Run default NSE reconnaissance scripts"},
|
|
16
|
+
{"flag": "-O", "desc": "Enable OS detection"},
|
|
17
|
+
{"flag": "-p-", "desc": "Scan all 65,535 ports"},
|
|
18
|
+
{"flag": "-T4", "desc": "Aggressive timing template (faster scan)"},
|
|
19
|
+
{"flag": "-Pn", "desc": "Skip host discovery (treat host as online)"}
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
"gobuster": {
|
|
23
|
+
"target_label": "Subcommand & URL (e.g. dir -u http://target.com -w /usr/share/wordlists/dirb/common.txt)",
|
|
24
|
+
"flags": [
|
|
25
|
+
{"flag": "-x php,html,txt", "desc": "File extensions to search for"},
|
|
26
|
+
{"flag": "-t 50", "desc": "Number of concurrent threads (50)"},
|
|
27
|
+
{"flag": "-k", "desc": "Skip SSL certificate verification"},
|
|
28
|
+
{"flag": "-q", "desc": "Quiet mode (hide banner)"}
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"hydra": {
|
|
32
|
+
"target_label": "Target & Service (e.g. -l admin -P /usr/share/wordlists/rockyou.txt 10.10.10.5 ssh)",
|
|
33
|
+
"flags": [
|
|
34
|
+
{"flag": "-V", "desc": "Verbose mode (show login+pass combination)"},
|
|
35
|
+
{"flag": "-f", "desc": "Exit after the first found login/password pair"},
|
|
36
|
+
{"flag": "-t 4", "desc": "Limit parallel tasks to 4 (prevents lockouts)"}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"distro_name": "Parrot Security OS",
|
|
3
|
+
"accent_color": "green",
|
|
4
|
+
"categories": {
|
|
5
|
+
"Privacy & Anonymity": ["tor", "proxychains4", "macchanger", "openvpn"],
|
|
6
|
+
"Recon & Network": ["nmap", "wireshark", "tcpdump", "dig", "whois"],
|
|
7
|
+
"Forensics & Files": ["binwalk", "exiftool", "strings", "find", "grep"]
|
|
8
|
+
},
|
|
9
|
+
"curated_flags": {}
|
|
10
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: linise
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Linux Interactive Shell Environment — A PowerShell ISE-style command explorer and visual flag builder for Linux.
|
|
5
|
+
Requires-Python: >=3.9
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Dist: textual>=0.50.0
|
|
9
|
+
Dynamic: license-file
|
|
10
|
+
|
|
11
|
+
# ⚡ LinISE — Linux Interactive Shell Environment
|
|
12
|
+
|
|
13
|
+
**A PowerShell ISE-inspired command explorer, visual flag builder, and step-by-step AI command tutor built for Linux terminals.**
|
|
14
|
+
|
|
15
|
+
LinISE bridges the gap for Windows users, IT students, and cybersecurity beginners transitioning from PowerShell ISE's structured `Show-Command` pane to the Linux CLI.
|
|
16
|
+
|
|
17
|
+
## ✨ Key Features
|
|
18
|
+
- **Auto-Distro Detection:** Automatically detects **Kali Linux**, **Parrot OS**, or standard Linux distributions and tailors command categories accordingly.
|
|
19
|
+
- **Visual Flag Builder:** Browse installed tools and toggle curated or auto-parsed `--help` flags as clickable cards to assemble complex commands live.
|
|
20
|
+
- **AI Co-Pilot & Guided Missions:** Includes built-in step-by-step beginner walkthroughs plus a Bring-Your-Own-Key (BYOK) Gemini translator that converts plain English into runnable commands with flag explanations.
|
|
21
|
+
- **Multi-Line Script Editor:** Append assembled commands directly into a `.sh` script editor, save executable scripts, and run them in-app.
|
|
22
|
+
- **Interactive Shell & Safety Guardrails:** Drop into a native interactive shell (`↗ Interactive Shell`) for `sudo` or interactive tools, with automatic border alerts for destructive commands.
|
|
23
|
+
|
|
24
|
+
## 🚀 Quick Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install linise
|
|
28
|
+
linise
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
*(Recommended: Run inside **Windows Terminal**, **Alacritty**, or any modern TrueColor terminal emulator for full Obsidian theme rendering.)*
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
linise/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
linise/app.py,sha256=6GSM_aEkKOs7nYKyprAfLRC9th06zWYWCPmj1Igcgwg,19545
|
|
3
|
+
linise/profiles/generic.json,sha256=FgpuRUSUPNrok1T8xLQVY0n5JFzmSd3HUx9KeTy7r4s,341
|
|
4
|
+
linise/profiles/kali.json,sha256=3izQiqbqJz95nUaMugyELOsIGuJTD-ZoPMNqGBeEUhc,1793
|
|
5
|
+
linise/profiles/parrot.json,sha256=KKXa-0Xov422eFY4CvvhDsLmQG-hTnmUr3C4tg9_tZ4,341
|
|
6
|
+
linise-0.1.0.dist-info/licenses/LICENSE,sha256=-reSFthav7gSS5lvyEdIUPx5CLpZgkxg0wv8VegIn5M,1069
|
|
7
|
+
linise-0.1.0.dist-info/METADATA,sha256=RfOBb8g_nPpzSoONKvUETp3STgxfSZ1C_8J0tqKXGS8,1761
|
|
8
|
+
linise-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
9
|
+
linise-0.1.0.dist-info/entry_points.txt,sha256=nadyka82r8k-Y9wWcpatRfWKx-QpgjmRunSFiAVejMo,43
|
|
10
|
+
linise-0.1.0.dist-info/top_level.txt,sha256=FSfCEuER1wJJKTWUNhioN2RYwDkAU54mjA-J0NpIoqo,7
|
|
11
|
+
linise-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 bakerdylan23
|
|
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.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
linise
|