Skip to content

Commit fc13d05

Browse files
committed
update: workspaced zshrc and documents
1 parent c8a830c commit fc13d05

File tree

4 files changed

+43
-13
lines changed

4 files changed

+43
-13
lines changed

.vscode/.zshrc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# POST executed after the shell is loaded
2+
# This file is loaded after .zshrc
3+
4+
# This file can be empty of deleted if not needed
5+
# Loading Order
6+
# vscode ==(inject PROJECT_FOLDER and check settings.json)==> source.zsh (PreHandling)
7+
# source.zsh ==(source env.zsh)==> env.zsh
8+
# source.zsh ==(Check Mode)==> Do any IF condition or keep continue
9+
# source.zsh ==(exec zsh -i)==> ~/.zshrc
10+
# ~/.zshrc ==(contains weapon_vscode_launch_helper function)==> launch_helper.zsh
11+
# ~/.zshrc ==(if set, PROJECT_FOLDER and .vscode/.zshrc exists, source it)==> .vscode/.zshrc
12+
13+
# you can define any function
14+
15+
if [ -d "$PROJECT_FOLDER/venv" ]; then
16+
source $PROJECT_FOLDER/venv/bin/activate
17+
fi

documents/CUSTOM.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
> like `vscode setting.json tasks.json` and metasploit workspace rcfile `workspace_metasploit.rc`
1010
11+
3. Check [LaunchOrder.md](./LaunchOrder.md) for the launch order of zsh files and it will explain how they works.
12+
1113
### How to customize it?
1214

1315
#### in disk temporary
@@ -55,8 +57,12 @@
5557
> `tasks.json` defines commands which will run just once.
5658
>
5759
> current task is msfvenom payload fast generate task.
60+
>
61+
> `extension.json` defines the extension you'd better to install in vscode.
62+
>
63+
> it extends vscode with other strong features like code analysis, code completion, etc.
5864
59-
- `env.zsh` for environments variables you want to set. it should be sourced at first line in `source_*.zsh` and `source.zsh`. (recommended to source it in every .zsh file under .vscode folder)
65+
- `env.zsh` for environments variables you want to set. it should be sourced `source*.zsh`. (recommended to source it in every .zsh file under .vscode folder)
6066

6167
> e.g. `export RHOST=11.45.1.4`
6268
>
@@ -67,15 +73,12 @@
6773
> e.g. `cd $PROJECT_FOLDER` switch the pwd back to the project
6874
>
6975
70-
- `source_*.zsh` files for you to source your own scripts
76+
- `source.zsh` file will control the zsh shell behavior in vscode terminal with mode
7177

72-
> e.g. `source_web-delivery.zsh` will be used when you use `web-delivery` mode in your new vscode terminal.
78+
> e.g. `source.zsh` will be used when you set env varoiable `WEB_DELIVERY_MODE` in your new vscode terminal.
7379
>
74-
> and you can put your own script in it
80+
> you will launched a new zsh shell and execute the WEB_DELIVERY_MODE command in the block
7581
76-
77-
> `zsh-shell` will create a new zsh shell with sourcing `source.zsh` file
78-
>
7982
> `meterpreter-handler` will launch up a new msfconsole with the metasploit rcfile
8083
> this terminal will called with msfconsole command in `source source_metasploit.zsh` file
8184
>
@@ -84,13 +87,13 @@
8487
> `web-delivery` will cd into the $PROJECT_WEB_DELIVERY folder and start a python http server for you to delivery web files. It based on `source source_web-delivery.zsh` file.
8588
> > you can use pdteam's simplehttpserver to replace it.
8689
>
87-
> `kali-orbstack` will launch orbstack virtual machine - kalilinx, source `source _kali-orbstack.zsh` and process env variables in `env.zsh` file inside env.
88-
>
90+
91+
- `kali-orbstack` file will launch orbstack virtual machine - kalilinx, source `source_kali-orbstack.zsh` and process env variables in `env.zsh` file inside env. it will also control the zsh behavior but in kali vm.
92+
8993
> > you can easily inject environment variables into the kali vm with this mode. and reuse command outside.
9094
> >
9195
> > like `evil-winrm -i $RHOST -u $RUSER -p $RPASS` will work in kali vm and host machine. and you just need set the env variables in `env.zsh` file once.
9296
93-
9497
- metasploit rcfile `metasploit_handler.rc` for you to use in vscode terminal (meterpreter-handler mode)
9598

9699
> it launched as `msfconsole -r this.rc`

documents/LaunchOrder.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# all zsh file launch order
2+
3+
```mermaid
4+
graph TD;
5+
6+
vscode ==(inject PROJECT_FOLDER and check settings.json)==> source.zsh(.vscode/source.zsh)
7+
source.zsh ==(1.source env.zsh)==> source.zsh_enved(.vscode/source.zsh) ==(2.Check Mode)==> source.zsh_mode(.vscode/source.zsh) ==> source.zsh_call_zsh(.vscode/source.zsh) & node(execute other commands like netcat handler)
8+
source.zsh_call_zsh(.vscode/source.zsh) ==(exec zsh -i)==> home_zshrc(~/.zshrc)
9+
home_zshrc ==(contains weapon_vscode_launch_helper function)==> home_zshrc_call_helper(~/.zshrc)
10+
home_zshrc_call_helper ==(if set env PROJECT_FOLDER and file .vscode/.zshrc exists, source it)==> execute_project_folder_zshrc(.vscode/.zshrc)
11+
```

launch_helper.zsh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
weapon_vscode_launch_helper () {
22
if [ -n "$PROJECT_FOLDER" ]; then
3-
# do anything if PROJECT_FOLDER is set
4-
if [ -d "$PROJECT_FOLDER/venv" ]; then
5-
source $PROJECT_FOLDER/venv/bin/activate
3+
if [ -f "$PROJECT_FOLDER/.vscode/.zshrc" ]; then
4+
source $PROJECT_FOLDER/.vscode/.zshrc
65
fi
76
fi
87
}

0 commit comments

Comments
 (0)