Skip to content

Conversation

@Mzack9999
Copy link
Member

  • Optional path modification
  • Supports set/unset via -sp/-up

@Mzack9999 Mzack9999 added the Type: Enhancement Most issues will probably ask for additions or changes. label Feb 3, 2023
@Mzack9999 Mzack9999 self-assigned this Feb 3, 2023
@Mzack9999 Mzack9999 marked this pull request as draft February 3, 2023 11:56
@Mzack9999 Mzack9999 linked an issue Feb 3, 2023 that may be closed by this pull request
@Mzack9999 Mzack9999 marked this pull request as ready for review February 3, 2023 13:58
Copy link
Member

@tarunKoyalwar tarunKoyalwar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mzack9999 , Printing PATH env variable values does not seem necessary/good idea.

./pdtm 

                ____          
     ____  ____/ / /_____ ___ 
    / __ \/ __  / __/ __ __  \
   / /_/ / /_/ / /_/ / / / / /
  / .___/\__,_/\__/_/ /_/ /_/ 
 /_/                          v0.0.3

		projectdiscovery.io

[INF] [OS: DARWIN] [ARCH: ARM64] [GO: 1.19.4]
[INF] Path to download project binary: /Users/tarun/.pdtm/go/bin

[INF] Path /Users/tarun/.pdtm/go/bin configured in environment variable $PATH: /Users/tarun/.pdtm/go/bin,/opt/homebrew/opt/libpcap/bin,/Users/tarun/.projectdiscovery,/opt/homebrew/opt/openjdk/bin,/Users/tarun/go/bin,/opt/local/bin,/opt/local/sbin,/opt/homebrew/sbin,/opt/homebrew/bin
1. subfinder (latest) (2.5.5)
2. dnsx (latest) (1.1.1)
3. naabu (latest) (2.1.1)
4. httpx (latest) (1.2.6)
5. nuclei (latest) (2.8.8)
6. uncover (latest) (1.0.2)
7. cloudlist (latest) (1.0.2)
8. proxify (latest) (0.0.8)
9. tlsx (latest) (1.0.5)
10. notify (latest) (1.0.4)
11. chaos-client (latest) (0.4.0)
12. shuffledns (latest) (1.0.8)
13. mapcidr (latest) (1.0.3)
14. interactsh-client (latest) (1.0.7)
15. katana (latest) (0.0.3)

@tarunKoyalwar
Copy link
Member

@Mzack9999 , I was thinking we could something similar to this

./pdtm 

                ____          
     ____  ____/ / /_____ ___ 
    / __ \/ __  / __/ __ __  \
   / /_/ / /_/ / /_/ / / / / /
  / .___/\__,_/\__/_/ /_/ /_/ 
 /_/                          v0.0.3

		projectdiscovery.io

[INF] [OS: DARWIN] [ARCH: ARM64] [GO: 1.19.4]
[INF] Path to download project binary: /Users/tarun/.pdtm/go/bin
[INF] Path /Users/tarun/.pdtm/go/bin configured in environment variable $PATH: 

1. subfinder (latest) (2.5.5)
2. dnsx (latest) (1.1.1)
3. naabu (latest) (2.1.1)
4. httpx (latest) (1.2.6)
5. nuclei (latest) (2.8.8)
6. uncover (latest) (1.0.2)
7. cloudlist (latest) (1.0.2)
8. proxify (latest) (0.0.8)
9. tlsx (latest) (1.0.5)
10. notify (latest) (1.0.4)
11. chaos-client (latest) (0.4.0)
12. shuffledns (latest) (1.0.8)
13. mapcidr (latest) (1.0.3)
14. interactsh-client (latest) (1.0.7)
15. katana (latest) (0.0.3)

Copy link
Member

@tarunKoyalwar tarunKoyalwar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm !

$ ./pdtm 

                ____          
     ____  ____/ / /_____ ___ 
    / __ \/ __  / __/ __ __  \
   / /_/ / /_/ / /_/ / / / / /
  / .___/\__,_/\__/_/ /_/ /_/ 
 /_/                          v0.0.3

		projectdiscovery.io

[INF] [OS: DARWIN] [ARCH: ARM64] [GO: 1.19.4]
[INF] Path to download project binary: /Users/tarun/.pdtm/go/bin
[INF] Path /Users/tarun/.pdtm/go/bin configured in environment variable $PATH
1. subfinder version not found
2. dnsx version not found
3. naabu version not found
4. httpx (latest) (1.2.7)
5. nuclei version not found
6. uncover version not found
7. cloudlist version not found
8. proxify version not found
9. tlsx (latest) (1.0.5)
10. notify version not found
11. chaos-client version not found
12. shuffledns version not found
13. mapcidr version not found
14. interactsh-client version not found
15. katana (latest) (0.0.3)

@Mzack9999 since we only track/show/update tools installed via pdtm (i.e $HOME/.pdtm) Instead of printing nuclei version not found what do you think if we did something like this

$ ./pdtm 

                ____          
     ____  ____/ / /_____ ___ 
    / __ \/ __  / __/ __ __  \
   / /_/ / /_/ / /_/ / / / / /
  / .___/\__,_/\__/_/ /_/ /_/ 
 /_/                          v0.0.3

		projectdiscovery.io

[INF] [OS: DARWIN] [ARCH: ARM64] [GO: 1.19.4]
[INF] Path to download project binary: /Users/tarun/.pdtm/go/bin
[INF] Path /Users/tarun/.pdtm/go/bin configured in environment variable $PATH

1. httpx (latest) (1.2.7)
2. tlsx (latest) (1.0.5)
3. katana (latest) (0.0.3)

[INF] Tools not tracked[installed] by pdtm

1. nuclei version not found
2. uncover version not found
3. cloudlist version not found
4. notify version not found
5. chaos-client version not found
6. shuffledns version not found
7. mapcidr version not found
8. interactsh-client version not found
9. subfinder version not found
10. dnsx version not found
11. naabu version not found

@tarunKoyalwar
Copy link
Member

since there were some issues with pdtm many users installed tools via go tool adding such details/description would help and also avoid conflicts with old installations etc

@tarunKoyalwar
Copy link
Member

@Mzack9999 , since path modification is disabled by default what do you think of alias ?
i.e when we install say nuclei we alias full path with with name this way there won't be any direct path modification or related concerns .

alias nuclei="/Users/tarun/.pdtm/go/bin/nuclei"

What do you think ?

@Mzack9999
Copy link
Member Author

Still, to make it persistent, it's necessary to store it somewhere on the system. I think we can suggest to the user the command to execute (pdtm or system commands). As a reference, homebrew indicates to the user the commands to copy/paste and execute.

@Mzack9999
Copy link
Member Author

Todo: (cc @tarunKoyalwar )

  • Path modification should be enabled (actual default behavior and expected one by users with no setup effort - even if a bit invasive)
  • CRUD operations for tools within $home directory
  • Read-only operations for tools outside $home directory

@Mzack9999 Mzack9999 requested a review from tarunKoyalwar March 13, 2023 11:45
Copy link
Member

@tarunKoyalwar tarunKoyalwar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$  go run . -u nuclei

                ____          
     ____  ____/ / /_____ ___ 
    / __ \/ __  / __/ __ __  \
   / /_/ / /_/ / /_/ / / / / /
  / .___/\__,_/\__/_/ /_/ /_/ 
 /_/                          v0.0.4

		projectdiscovery.io

parent is /Users/tarun
sub is /Users/tarun/.pdtm/go/bin
[INF] nuclei: not found in path /Users/tarun/.pdtm/go/bin/nuclei
got error here
[ERR] error while updating nuclei: tool nuclei not found in path /Users/tarun/.pdtm/go/bin/nuclei: skipping

Revisting CRUD operations other than (default PDTM PATH)

  • Now after trying this out , I think we don't need all CRUD operations supported for cases when path is different from default PATH
As a User, I think pdtm should detect all pd tools , install them if explicitly mentioned and update my tools (installed with pdtm and without pdtm [Keeping HOME FOLDER restriction HERE]) also I don't want pdtm to take complete ownership (DELETE PERM) of tools that were not installed via pdtm

so I think we should only support READ UPDATE for tools outside of pdtm default path . this way we are less invasive keeping User experience same . What do you think @Mzack9999

@Mzack9999
Copy link
Member Author

Mzack9999 commented Mar 13, 2023

@tarunKoyalwar I'm unable to reproduce it:

$ ls /Users/marcornvh/.pdtm/go/bin/nuclei 
/Users/marcornvh/.pdtm/go/bin/nuclei
$  go run . -u nuclei

                ____          
     ____  ____/ / /_____ ___ 
    / __ \/ __  / __/ __ __  \
   / /_/ / /_/ / /_/ / / / / /
  / .___/\__,_/\__/_/ /_/ /_/ 
 /_/                          v0.0.4

                projectdiscovery.io

[INF] nuclei: already up to date

Testing on OSX latest

I'm not sure we should update tools arbitrarily outside of scoped directories. Eventually one improvement we might try, is to detect if they are within the go bin folder, and in such case trigger the install via go install. What do you think?

@tarunKoyalwar
Copy link
Member

@Mzack9999

  • currently if I try to update tool not installed by pdtm (or not installed at all) it tries to update it and fails . we probably should add a check here before updating
  • Another change related to update that if user wants to update nuclei but it is not installed via pdtm (maybe installed via package manager or go install) we can just install a new version in .pdtm/go/bin and since PATH is added by default nuclei at .pdtm/go/bin is picked everytime and this won't be invasive at all

@Mzack9999
Copy link
Member Author

@tarunKoyalwar do you mean installing the tool if not present? Actually if the tool is not installed we skip all I/O operations and just return an error

@Mzack9999 Mzack9999 requested a review from tarunKoyalwar March 20, 2023 13:07
@tarunKoyalwar
Copy link
Member

tarunKoyalwar commented Mar 20, 2023

@Mzack9999 , not installing but a additional check before updating a tool when we try to update any not existent tool

$ which dnsx
dnsx not found
 $ ./pdtm -u dnsx                           

                ____          
     ____  ____/ / /_____ ___ 
    / __ \/ __  / __/ __ __  \
   / /_/ / /_/ / /_/ / / / / /
  / .___/\__,_/\__/_/ /_/ /_/ 
 /_/                          v0.0.4

		projectdiscovery.io

[INF] Current pdtm version v0.0.4 (latest)
[INF] dnsx: not found in path /Users/tarun/.pdtm/go/bin/dnsx
[ERR] error while updating dnsx: tool dnsx not found in path /Users/tarun/.pdtm/go/bin/dnsx: skipping

as you can see in above example . pdtm first tries to find if dnsx is in path . if not it should fail silently (or skip the next step). instead currently even tries to update a not existent tool and returns [Err]

I think the proper output for this should be

 $ ./pdtm -u dnsx                           

                ____          
     ____  ____/ / /_____ ___ 
    / __ \/ __  / __/ __ __  \
   / /_/ / /_/ / /_/ / / / / /
  / .___/\__,_/\__/_/ /_/ /_/ 
 /_/                          v0.0.4

		projectdiscovery.io

[INF] Current pdtm version v0.0.4 (latest)
[INF] dnsx: not found in path /Users/tarun/.pdtm/go/bin/dnsx: skipping update

Copy link
Member

@ehsandeep ehsandeep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pdtm $./pdtm -ua

                ____          
     ____  ____/ / /_____ ___ 
    / __ \/ __  / __/ __ __  \
   / /_/ / /_/ / /_/ / / / / /
  / .___/\__,_/\__/_/ /_/ /_/ 
 /_/                          v0.0.4

		projectdiscovery.io

[INF] Current pdtm version v0.0.4 (latest)
[INF] subfinder: already up to date
[INF] dnsx: already up to date
[INF] naabu: already up to date
[INF] httpx: already up to date
[INF] nuclei: already up to date
[INF] uncover: already up to date
[INF] cloudlist: already up to date
[INF] proxify: already up to date
[INF] tlsx: already up to date
[INF] notify: already up to date
[INF] chaos-client: already up to date
[INF] shuffledns: already up to date
[INF] mapcidr: already up to date
[INF] interactsh-client: already up to date
[INF] katana: already up to date
[INF] pdtm: already up to date
[INF] asnmap: already up to date


pdtm $./pdtm -ia

                ____          
     ____  ____/ / /_____ ___ 
    / __ \/ __  / __/ __ __  \
   / /_/ / /_/ / /_/ / / / / /
  / .___/\__,_/\__/_/ /_/ /_/ 
 /_/                          v0.0.4

		projectdiscovery.io

[INF] Current pdtm version v0.0.4 (latest)
[INF] subfinder: already installed
[INF] dnsx: already installed
[INF] naabu: already installed
[INF] httpx: already installed
[INF] nuclei: already installed
[INF] uncover: already installed
[INF] cloudlist: already installed
[INF] proxify: already installed
[INF] tlsx: already installed
[INF] notify: already installed
[INF] chaos-client: already installed
[INF] shuffledns: already installed
[INF] mapcidr: already installed
[INF] interactsh-client: already installed
[INF] katana: already installed
[INF] pdtm: already installed
[INF] asnmap: already installed

@ehsandeep ehsandeep modified the milestone: pdtm v0.0.5 Mar 20, 2023
Copy link
Member

@tarunKoyalwar tarunKoyalwar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm !

$ ./pdtm 

                ____          
     ____  ____/ / /_____ ___ 
    / __ \/ __  / __/ __ __  \
   / /_/ / /_/ / /_/ / / / / /
  / .___/\__,_/\__/_/ /_/ /_/ 
 /_/                          v0.0.4

		projectdiscovery.io

[INF] Current pdtm version v0.0.4 (latest)
[INF] [OS: DARWIN] [ARCH: ARM64] [GO: 1.20.2]
[INF] Path to download project binary: /Users/tarun/.pdtm/go/bin
[INF] Path /Users/tarun/.pdtm/go/bin configured in environment variable $PATH
1. subfinder (latest) (2.5.7)
2. dnsx (latest) (1.1.3)
3. naabu (latest) (2.1.4)
4. httpx (latest) (1.2.9)
5. nuclei (not installed)
6. uncover (latest) (1.0.3)
7. cloudlist (latest) (1.0.2)
8. proxify (latest) (0.0.8)
9. tlsx (latest) (1.0.6)
10. notify (latest) (1.0.4)
11. chaos-client (latest) (0.5.1)
12. shuffledns (latest) (1.0.8)
13. mapcidr (latest) (1.1.1)
14. interactsh-client (latest) (1.1.2)
15. katana (latest) (1.0.0)
16. pdtm (latest) (0.0.4)
17. asnmap (latest) (1.0.2)

@tarunKoyalwar tarunKoyalwar requested a review from ehsandeep March 21, 2023 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Enhancement Most issues will probably ask for additions or changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Env Path variable modification should be optional

4 participants