Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyb3rWard0g authored and Cyb3rWard0g committed Nov 4, 2023
1 parent a129c71 commit 4830c32
Show file tree
Hide file tree
Showing 23 changed files with 2,864 additions and 164 deletions.
2 changes: 1 addition & 1 deletion .buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: dc5dc8d52cd9d7a6b5f45e7ccfc206a0
config: fefabd31c006fccbf2184c02cc42bcc2
tags: 645f666f9bcd5a90fca523b33c5a78b7
24 changes: 13 additions & 11 deletions README.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />

<title>GPT Security Adventures &#8212; GPT Security Adventures</title>
<title>Generative AI Security Adventures &#8212; GenAI Security Adventures</title>



Expand Down Expand Up @@ -156,8 +156,10 @@
</ul>
<p aria-level="2" class="caption" role="heading"><span class="caption-text">Experiments</span></p>
<ul class="nav bd-sidenav">
<li class="toctree-l1"><a class="reference internal" href="experiments/Basics/OAI-Inferring-Sentiment.html">Inferring: Sentiment Classifier</a></li>
<li class="toctree-l1"><a class="reference internal" href="experiments/Basics/OAI-Summarizing-Incident.html">Summarizing: Incident Data</a></li>
<li class="toctree-l1"><a class="reference internal" href="experiments/Basics/Local-Tokenizing-Embedding.html">Local: Tokenizing &amp; Embedding</a></li>
<li class="toctree-l1"><a class="reference internal" href="experiments/Basics/Local-Inferring-Sentiment.html">Inferring: Local Sentiment Classifier</a></li>
<li class="toctree-l1"><a class="reference internal" href="experiments/Basics/OAI-Inferring-Sentiment.html">Inferring: Remote Sentiment Classifier</a></li>
<li class="toctree-l1"><a class="reference internal" href="experiments/Basics/OAI-Summarizing-Incident.html">Summarizing: Remote Incident Handler</a></li>
<li class="toctree-l1"><a class="reference internal" href="experiments/RAG/Threat-Intelligence/ATTCK-Groups/source-knowledge/notebook.html">Create ATT&amp;CK Groups Source knowledge</a></li>
<li class="toctree-l1"><a class="reference internal" href="experiments/RAG/Threat-Intelligence/ATTCK-Groups/LangChain/notebook.html">RAG - LangChain and ATT&amp;CK Groups</a></li>
<li class="toctree-l1"><a class="reference internal" href="experiments/RAG/Threat-Intelligence/ATTCK-Groups/AutoGen/notebook.html">RAG - AutoGen and ATT&amp;CK Groups</a></li>
Expand Down Expand Up @@ -347,7 +349,7 @@


<div id="jb-print-docs-body" class="onlyprint">
<h1>GPT Security Adventures</h1>
<h1>Generative AI Security Adventures</h1>
<!-- Table of contents -->
<div id="print-main-content">
<div id="jb-print-toc">
Expand All @@ -357,7 +359,7 @@ <h2> Contents </h2>
</div>
<nav aria-label="Page">
<ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#https-otrf-github-io-gpt-security-adventures-readme-html">https://otrf.github.io/GPT-Security-Adventures/README.html</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#https-otrf-github-io-genai-security-adventures-readme-html">https://otrf.github.io/GenAI-Security-Adventures/README.html</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#contributing">Contributing</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#presentations">Presentations</a></li>
</ul>
Expand All @@ -371,18 +373,18 @@ <h2> Contents </h2>
<div id="searchbox"></div>
<article class="bd-article" role="main">

<section class="tex2jax_ignore mathjax_ignore" id="gpt-security-adventures">
<h1>GPT Security Adventures<a class="headerlink" href="#gpt-security-adventures" title="Permalink to this heading">#</a></h1>
<section class="tex2jax_ignore mathjax_ignore" id="generative-ai-security-adventures">
<h1>Generative AI Security Adventures<a class="headerlink" href="#generative-ai-security-adventures" title="Permalink to this heading">#</a></h1>
<p><a class="reference external" href="https://cyb3rward0g.github.io/GPT-Security-Adventures/README.html"><img alt="Jupyter Book Badge" src="https://jupyterbook.org/badge.svg" /></a>
<a class="reference external" href="https://github.com/ellerbrock/open-source-badges/"><img alt="Open Source Love svg1" src="https://badges.frapsoft.com/os/v3/open-source.svg?v=103" /></a>
<a class="reference external" href="https://github.com/Cyb3rWard0g/GPT-Security-Adventures/blob/main/LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg" /></a></p>
<p>An open-source initiative to share notes, presentations, and a diverse collection of experiments presented in Jupyter Notebooks, all aimed at helping you grasp the essential concepts behind large language models and exploring the intriguing intersection of security and natural language processing.</p>
<section id="https-otrf-github-io-gpt-security-adventures-readme-html">
<h2><a class="reference external" href="https://otrf.github.io/GPT-Security-Adventures/README.html">https://otrf.github.io/GPT-Security-Adventures/README.html</a><a class="headerlink" href="#https-otrf-github-io-gpt-security-adventures-readme-html" title="Permalink to this heading">#</a></h2>
<section id="https-otrf-github-io-genai-security-adventures-readme-html">
<h2><a class="reference external" href="https://otrf.github.io/GenAI-Security-Adventures/README.html">https://otrf.github.io/GenAI-Security-Adventures/README.html</a><a class="headerlink" href="#https-otrf-github-io-genai-security-adventures-readme-html" title="Permalink to this heading">#</a></h2>
</section>
<section id="contributing">
<h2>Contributing<a class="headerlink" href="#contributing" title="Permalink to this heading">#</a></h2>
<p>We encourage everyone interested in exploring the connection between security and natural language processing using large language models, such as those from the GPT family, to contribute to our project. If you have an experiment or adventure to share, please don’t hesitate to submit a pull request! Consider this repository as a platform to showcase your proof of concept before creating a more advanced repository to put it into action. Your contributions are highly valued and welcomed!</p>
<p>We encourage everyone interested in exploring the connection between security and natural language processing using large language models, such as those from the GPT family, to contribute to our project. If you have an experiment that you would like to share, please don’t hesitate to submit a pull request! Consider this repository as a platform to showcase your proof of concept before creating a more advanced repository to put it into action. Your contributions are highly valued and welcomed!</p>
</section>
<section id="presentations">
<h2>Presentations<a class="headerlink" href="#presentations" title="Permalink to this heading">#</a></h2>
Expand Down Expand Up @@ -454,7 +456,7 @@ <h2>Presentations<a class="headerlink" href="#presentations" title="Permalink to
</div>
<nav class="bd-toc-nav page-toc">
<ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#https-otrf-github-io-gpt-security-adventures-readme-html">https://otrf.github.io/GPT-Security-Adventures/README.html</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#https-otrf-github-io-genai-security-adventures-readme-html">https://otrf.github.io/GenAI-Security-Adventures/README.html</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#contributing">Contributing</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#presentations">Presentations</a></li>
</ul>
Expand Down
6 changes: 3 additions & 3 deletions _sources/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# GPT Security Adventures
# Generative AI Security Adventures

[![Jupyter Book Badge](https://jupyterbook.org/badge.svg)](https://cyb3rward0g.github.io/GPT-Security-Adventures/README.html)
[![Open Source Love svg1](https://badges.frapsoft.com/os/v3/open-source.svg?v=103)](https://github.com/ellerbrock/open-source-badges/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/Cyb3rWard0g/GPT-Security-Adventures/blob/main/LICENSE)

An open-source initiative to share notes, presentations, and a diverse collection of experiments presented in Jupyter Notebooks, all aimed at helping you grasp the essential concepts behind large language models and exploring the intriguing intersection of security and natural language processing.

## https://otrf.github.io/GPT-Security-Adventures/README.html
## https://otrf.github.io/GenAI-Security-Adventures/README.html

## Contributing

We encourage everyone interested in exploring the connection between security and natural language processing using large language models, such as those from the GPT family, to contribute to our project. If you have an experiment or adventure to share, please don't hesitate to submit a pull request! Consider this repository as a platform to showcase your proof of concept before creating a more advanced repository to put it into action. Your contributions are highly valued and welcomed!
We encourage everyone interested in exploring the connection between security and natural language processing using large language models, such as those from the GPT family, to contribute to our project. If you have an experiment that you would like to share, please don't hesitate to submit a pull request! Consider this repository as a platform to showcase your proof of concept before creating a more advanced repository to put it into action. Your contributions are highly valued and welcomed!

## Presentations

Expand Down
193 changes: 193 additions & 0 deletions _sources/experiments/Basics/Local-Inferring-Sentiment.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Inferring: Local Sentiment Classifier\n",
"---\n",
"* Collaborators:\n",
" * Roberto Rodriguez (@Cyb3rWard0g)\n",
"* References:\n",
" * https://www.deeplearning.ai/short-courses/\n",
" * https://medium.com/@ssmaameri/private-llms-on-local-and-in-the-cloud-with-langchain-gpt4all-and-cerebrium-6dade79f45f6\n",
" * https://docs.gpt4all.io/gpt4all_python.html\n",
" * https://raw.githubusercontent.com/nomic-ai/gpt4all/main/gpt4all-chat/metadata/models.json"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Import Modules"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from langchain.llms import GPT4All"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Initialize GPT4All with Local Model"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# Model downloaded manually from https://gpt4all.io/index.html\n",
"llm = GPT4All(model='./model/orca-mini-3b-gguf2-q4_0.gguf')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Email Sentiment Classifier"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Create Prompt Classifier"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"prompt = \"\"\"\n",
"Classify the email subject text below, delimited by three dashes (-),\n",
"as being malicious or benign. Explain why.\n",
"\n",
"---\n",
"Account email verification code, enter now and reply\n",
"---\n",
"\"\"\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Run Prompt"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'\\nThis email is likely to be considered as a phishing attempt because it requests the recipient to provide an account verification code that they may not have received from the actual email provider. Additionally, the email does not contain any legitimate information or context that would make the recipient believe that this is a genuine request for account verification. Therefore, it can be classified as malicious.'"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"llm(prompt)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Provide a few Examples (Few-Shot Learning)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"prompt = \"\"\"\n",
"Classify the email subject text below, delimited by triple backticks ('''),\n",
"as being malicious or benign. Explain why.\n",
"\n",
"Examples:\n",
"\n",
"Subjet: CY23 Email Verification Now\n",
"Label: malicious\n",
"\n",
"Subjet: Enter Market Email Verification Code Today\n",
"Label: malicious\n",
"\n",
"Subjet: New Account Email Verification Code Verify now\n",
"Label: malicious\n",
"\n",
"Subject: Submit your code review today\n",
"Label: benign\n",
"\n",
"Subject: '''Account email verification code, enter now and reply'''\n",
"Label:\n",
"\"\"\""
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'\\nSubject: **Your account email verification code**\\nLabel: benign'"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"llm(prompt)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading

0 comments on commit 4830c32

Please sign in to comment.