• About
  • Disclaimer
  • Privacy Policy
  • Contact
Friday, June 13, 2025
Cyber Defense GO
  • Login
  • Home
  • Cyber Security
  • Artificial Intelligence
  • Machine Learning
  • Data Analysis
  • Computer Networking
  • Disaster Restoration
No Result
View All Result
  • Home
  • Cyber Security
  • Artificial Intelligence
  • Machine Learning
  • Data Analysis
  • Computer Networking
  • Disaster Restoration
No Result
View All Result
Cyber Defense Go
No Result
View All Result
Home Computer Networking

Utilizing AI to Generate Instructions and Run it From Linux Command Shell (sgpt) – 51 Safety

Md Sazzad Hossain by Md Sazzad Hossain
0
Utilizing AI to Generate Instructions and Run it From Linux Command Shell (sgpt) – 51 Safety
585
SHARES
3.2k
VIEWS
Share on FacebookShare on Twitter

You might also like

AWS Summit Sydney – Accelerating AI from Prospects to Manufacturing – IT Connection

Is WiFi 7 Value It? Evaluating Early Wi-Fi 7 Adoption Advantages, Community Throughput & Extra.

The right way to use ChatGPT to put in writing code – and my prime trick for debugging what it generates


Shell GPT (SGPT) is a command-line software that integrates with OpenAI’s GPT-4 fashions to allow pure language processing (NLP) out of your Linux shell. It’s designed to simplify repetitive duties, generate scripts, and help with coding, all from throughout the terminal surroundings. SGPT is a strong software that brings the capabilities of OpenAI’s GPT fashions immediately into the Linux command line.

SGPT itself is free to put in and use, however you’ll need an OpenAI API key, which can include prices relying in your utilization tier. SGPT requires an energetic web connection because it depends on OpenAI’s cloud-based API to perform.

 

Necessities

  • Python Model: Python 3.6 or later
  • OpenAI API Key: You will have an API key from OpenAI to entry GPT fashions.

Step 1: Set up Python

SGPT requires Python to run. Most Linux distributions include Python pre-installed, but when not, you possibly can set up it utilizing:

Step 2: Set up pip (Python Bundle Installer)

You’ll want a pip to put in SGPT. Set up it utilizing the next command:

sudo apt set up python3-pip

Step 3: Set up SGPT

Now that Python and pip are put in, you possibly can set up SGPT utilizing pip:

pip set up shell-gpt --break-system-packages

observe: you’ll need so as to add –break-system-packages on the finish of command. Else, you’re going to get some warning messages and set up will probably be stopped. 

You need to use pip3 set up shell-gpt as nicely. 

Step 4: Confirm Set up

As soon as the set up is full, confirm that SGPT has been instsualled appropriately by operating:

┌──(root㉿kali)-[~/.config/shell_gpt]
└─# sgpt --version                                                                                       
ShellGPT 1.4.4

This could ask you to enter openai api key, then return the put in model of SGPT, confirming that it’s prepared to be used.

Establishing OpenAI API Key

 

Step 1: Get the OpenAI API Key

  • Go to the OpenAI API web site.
  • Enroll or log in to your account.
  • Navigate to the API part and generate a brand new API key.

After you arrange your account, click on in your account identify on the prime proper and go to your profile. You’ll then arrange billing and limits to fund your account. 

It would be best to fund your account. As a newbie or hobbyist, $5 USD is greater than sufficient for most individuals to get began. I might additionally advocate disabling auto billing/funding and setting limits. Should you don’t need any surprises, arrange your account correctly. 

Utilization:

Step 2: Set API Key in Setting Variables

zsh and bash are completely different shells that can be utilized on macOS and different Unix model OSes (Linux, BSD, macOS …). zsh is just like bash however has some extra options. 
zsh is the default shell in newer macOS variations whereas bash is the default for older ones. You possibly can change what shell will get used once you open an new tab or window in Terminal by going to the Terminal preferences. Each zsh and bash have plenty of completely different shell information that get run at completely different instances. The one you wish to edit is both .zshrc or .bashrc (relying in your selection of shell) – these particular information comprise shell instructions which are run each time you open a brand new Terminal window or tab.

After getting your API key, set it as an surroundings variable to permit SGPT to make use of it:

  • export OPENAI_API_KEY=”your-api-key-here”

Alternatively, you possibly can add this line to your ~/.zshrc to persist the important thing throughout periods:

  • echo ‘export OPENAI_API_KEY=”your-api-key-here”‘ >> ~/.zshrc 
  • supply ~/.zshrc

=================================================================

~/.config/shell_gpt/.sgptrc

Combine ShellGPT in Parrot Safety Machine

From EC-Council CEH Lab:

  1. Go to the OpenAI platform (https://platform.openai.com) and join or log in to your present account.

  2. As soon as logged in, click on the profile icon on the top-right, click on Your profile choice and navigate to the Billing part.

  3. Beneath Billing part, go to Cost strategies and click on Add fee technique so as to add a fee technique.

  4. Go to Overview and click on Add to credit score stability.

  5. Enter minimal quantity, i.e. $5 for Quantity so as to add, and click on proceed. Please refer https://openai.com/api/pricing/ for API pricing particulars.

  6. Click on Affirm fee and full the transaction so as to add the credit score stability.

  7. Now, click on Parrot Safety to modify to Parrot Safety machine and login with attacker/toor.

  8. Open a Terminal window and kind chromium and press Enter to launch Chromium net browser.

    2024-05-17_11-24-24.jpg

  9. The Chromium window seems, go to https://platform.openai.com/api-keys.

  10. An OpenAI Platform webpage seems, click on on Login and login to the OpenAI account which you’ve gotten created on the beginning of this lab.

  11. You’ll be redirected to Undertaking API Keys window, click on on + Create new secret key button to create a brand new key.

    2023-12-13_10-43-46.jpg

  12. A Create new secret key window seems, present a reputation for the key key (right here, CEH) and go away all of the settings as default, as proven within the screenshot and click on on Create secret key button.

    2024-05-17_11-27-16qqq.jpg

  13. Save your key pop-up seems, click on Copy button to repeat the important thing.

    2024-05-17_11-32-00.jpg

  14. Now, open a brand new terminal with superuser privileges, by executing sudo su command (When prompted, enter the password toor).

  15. Run sgpt command to launch ShellGPT software.

    2024-05-17_11-36-02.jpg

  16. You’ll be prompted to enter your OpenAI API key, paste the copied API key within the terminal window and press Enter.

    The key key you’ve gotten entered is not going to be seen.

  17. If the API key integration is profitable you need to obtain a message, as proven within the screenshot.

    2024-05-17_11-39-27.jpg

Configuring SGPT for Utilization

API secret’s saved at this location:

  •  ~/.config/shell_gpt/.sgptrc

===================================================

Following info is likely to be outdated. 

Config File:SGPT creates a configuration file at ~/.config/shell_gpt/config.yaml the place you possibly can regulate default behaviour like:

  • Default mannequin: Select between GPT fashions.
  • Temperature: Management randomness in responses.

You possibly can edit the configuration by operating:

  • nano ~/.config/shell_gpt/config.yaml

sgpt utilization Examples: Question

 Full listing of arguments

--model                           TEXT     OpenAI mannequin identify. [default: text-davinci-003]
--max-tokens INTEGER Strict size of output (phrases). [default: 2048]
--shell --no-shell Get shell command as output. [default: no-shell]
--execute --no-execute Used with --shell, will execute command. [default: no-execute]
--code --no-code Present solely code as output. [default: no-code]
--spinner --no-spinner Present loading spinner throughout API request. [default: spinner]
--animation --no-animation Typewriter animation. [default: animation]
--help Present this message and exit.

Question Examples:

  • sgpt –shell “make all information in present listing learn solely”
  • sgpt “Clarify how HTTP works.”
  • sgpt “Write a bash script to again up /residence/consumer/paperwork to /backup.”
  • sgpt “Clarify this Python code: def factorial(n): return 1 if n == 0 else n * factorial(n-1)”
  • sgpt “Create a bash script to again up /var/log to /backup/log each night time.”
  • sgpt “create a cron job script to run a database backup at midnight daily.”

sgpt utilization Examples:

Execute the shell code: 

sgpt –shell –execute “make all information in present listing learn solely”
# -> chmod 444 *
# -> Execute shell command? [y/N]: y
# …

  • sgpt –chat fp –shell “use fping  to seek out energetic hosts in native community 192.168.2.0/24”
    • fping -a -g 192.168.2.0/24 2>/dev/null
  • sgpt –chat footprint –shell “Use filetype search operator to acquire pdf information on the goal web site eccouncil.org and retailer the outcome within the ec-recon.txt file.”
    • curl -s “https://www.google.com/search?q=web site:eccouncil.org+filetype:pdf” -A “Mozilla/5.0″ | grep -oP ‘https?://[^”]+.pdf’ > ec-recon.txt
  • sgpt –chat footprint –shell “Use inurl search operator to obtail the Fortinet VPN login pages”
    • curl -s “https://www.google.com/search?q=inurl:%22/distant/loginpercent22+Fortinet+VPN” -A “Mozilla/5.0” | grep -oP ‘https?://S+’
  • sgpt –chat area –shell “Uncover all of the subdomains of ‘google.com’ utilizing dig command.”
  • sgpt –chat footprint –shell “Use Sublist3r to assemble an inventory of subdomains of the goal group eccouncil“
  • sgpt –chat fp –shell “Use theHarvester to assemble hosts related to ‘microsoft.com’, limiting outcomes to 200, and leveraging ‘duckduckgo’ as an information supply”
    • baidu may be supply as nicely
  • sgpt –shell “what’s my pc’s dns configuration”
    • nmcli dev present | grep ‘IP4.DNS’

Outputs:

──(root㉿kali)-[~]
└─# sgpt –chat fp –shell “Use theHarvester to assemble subdomains related to ‘microsoft.com’, limiting outcomes to 200, and leveraging ‘duckduckgo’ as an information supply”
theHarvester -d microsoft.com -l 200 -b duckduckgo
[E]xecute, [D]escribe, [A]bort: E
Learn proxies.yaml from /root/.theHarvester/proxies.yaml
*******************************************************************
*  _   _                                            _             *
* | |_| |__   ___    /  /__ _ _ ____   _____  ___| |_ ___ _ __  *
* | __|  _ / _   / /_/ / _` | ‘__ / / _ / __| __/ _ ‘__| *
* | |_| | | |  __/ / __  / (_| | |    V /  __/__ ||  __/ |    *
*  __|_| |_|___| / /_/ __,_|_|    _/ ___||___/_____|_|    *
*                                                                 *
* theHarvester 4.6.0                                              *
* Coded by Christian Martorella                                   *
* Edge-Safety Analysis                                          *
* [email protected]                                   *
*                                                                 *
*******************************************************************
[*] Goal: microsoft.com 
[*] Looking Duckduckgo. 
[*] No IPs discovered.                                            
[*] No emails discovered.                                          
[*] Hosts discovered: 27                                                                                                   
———————                                                                                                 
2Fblogs.microsoft.com                                                                                                 
2Fdocs.microsoft.com                                                                                                  
2Fdownload.microsoft.com                                                                                              
2Fmsdn.microsoft.com                                                                                                  
2Fnews.microsoft.com                                                                                                  
Docs.microsoft.com                                                                                                    
account.microsoft.com                                                                                                 
appsource.microsoft.com                                                                                               
azure.microsoft.com                                                                                                   
azuremarketplace.microsoft.com                                                                                        
blogs.microsoft.com                                                                                                   
browserdefaults.microsoft.com                                                                                         
careers.microsoft.com                                                                                                 
selection.microsoft.com                                                                                                  
copilot.microsoft.com                                                                                                 
developer.microsoft.com                                                                                               
docs.microsoft.com                                                                                                    
obtain.microsoft.com                                                                                                
go.microsoft.com                                                                                                      
study.microsoft.com                                                                                                   
msdn.microsoft.com                                                                                                    
information.microsoft.com                                                                                                    
privateness.microsoft.com                                                                                                 
schemas.microsoft.com                                                                                                 
assist.microsoft.com                                                                                                 
techcommunity.microsoft.com                                                                                           
visualstudio.microsoft.com   

Utilization Examples for Vulnerability Scanning

instance 1: Scan for open ports

sgpt –shell “Scan 192.168.2.22 for open ports”

instance 2: Scan for vulnerabilities

sgpt –shell “Scan 192.168.2.21 for vulnerabilities”

  • nmap -sV –script=vuln 192.168.2.21

instance 3: Use Nikto to scan for net vulnerabilities

sgpt –shell “use Nikto scan 192.168.2.20 for vulnerabilities”

Improve SGPT

wget https://github.com/tbckr/sgpt/releases/obtain/v2.15.0/sgpt-2.15.0-1.armv7hl.rpm

sudo apt-get set up alien
sudo alien sgpt-2.15.0-1.armv7hl.rpm
sudo dpkg -i sgpt-2.15.0-1.armv7hl.rpm

Movies

 

References

  • https://github.com/TheR1D/shell_gpt
  • https://notepad.51sec.org/51sec

Like this:

Like Loading…

Associated

Submit navigation

Tags: CommandCommandsGenerateLinuxRunSecuritysgptShell
Previous Post

DeepVerse 4D – AI som förstår världen i fyra dimensioner

Next Post

Why Tech Wants a Soul

Md Sazzad Hossain

Md Sazzad Hossain

Related Posts

That is Extending to GreenOps – IT Connection
Computer Networking

AWS Summit Sydney – Accelerating AI from Prospects to Manufacturing – IT Connection

by Md Sazzad Hossain
June 13, 2025
Is WiFi 7 Value It? Evaluating Early Wi-Fi 7 Adoption Advantages, Community Throughput & Extra.
Computer Networking

Is WiFi 7 Value It? Evaluating Early Wi-Fi 7 Adoption Advantages, Community Throughput & Extra.

by Md Sazzad Hossain
June 13, 2025
The right way to use ChatGPT to put in writing code – and my prime trick for debugging what it generates
Computer Networking

The right way to use ChatGPT to put in writing code – and my prime trick for debugging what it generates

by Md Sazzad Hossain
June 12, 2025
ArubaCX Can not Rely When Coping with VXLAN « ipSpace.internet weblog
Computer Networking

ArubaCX Can not Rely When Coping with VXLAN « ipSpace.internet weblog

by Md Sazzad Hossain
June 12, 2025
A query about BGP Confederations
Computer Networking

A query about BGP Confederations

by Md Sazzad Hossain
June 11, 2025
Next Post
Why Tech Wants a Soul

Why Tech Wants a Soul

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recommended

Evaluating IGP and BGP Information Middle Convergence « ipSpace.internet weblog

Static Routes to Default Gateways « ipSpace.internet weblog

March 25, 2025
Kinesiska MiniMax lanserar öppna källkodsmodeller

Take a look at: OpenAI o3-mini vs DeepSeek R1

February 5, 2025

Categories

  • Artificial Intelligence
  • Computer Networking
  • Cyber Security
  • Data Analysis
  • Disaster Restoration
  • Machine Learning

CyberDefenseGo

Welcome to CyberDefenseGo. We are a passionate team of technology enthusiasts, cybersecurity experts, and AI innovators dedicated to delivering high-quality, insightful content that helps individuals and organizations stay ahead of the ever-evolving digital landscape.

Recent

That is Extending to GreenOps – IT Connection

AWS Summit Sydney – Accelerating AI from Prospects to Manufacturing – IT Connection

June 13, 2025
How knowledge high quality eliminates friction factors within the CX

How knowledge high quality eliminates friction factors within the CX

June 13, 2025

Search

No Result
View All Result

© 2025 CyberDefenseGo - All Rights Reserved

No Result
View All Result
  • Home
  • Cyber Security
  • Artificial Intelligence
  • Machine Learning
  • Data Analysis
  • Computer Networking
  • Disaster Restoration

© 2025 CyberDefenseGo - All Rights Reserved

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In