Skip to content

nkcyber/ai-hacking-lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ai-hacking-lab

Learn about AI Hacking!

Screenshots:

Chatting:

image

Run locally

  1. Install templ, redis, Ollama, and Go.
  2. sudo systemctl start redis # start redis
    ollama run tinyllama # install model
    # then...
    templ generate # if you've made any modifications to .templ files
    go run main.go

Project Overview

This website is meant to serve as a simple framework for challenging students to manipulate large language models into doing what they want.

Administrators can provide prompts with CTF flags and challenge students to get the flags from the model. See ./example-prompts.json for example prompts. The URL determines prompt selection with /chat/{promptName}.

Note

Usage of ./ai-hacking-lab:
    -address string
        the address to host the server on (default ":3000")
    -maxTokens int
          the maximum number of tokens in a response. (default 100)
    -modelName string
          the name of the LLM in the Ollama library (default "tinyllama")
    -modelTemperature float
          the 'temperature' of the LLM (default 0.1)
    -redisAddress string
          the address to connect to redis on; must not include protocol (default "localhost:6379")
    -ollamaAddress string
          the address to connect to ollama on; must include protocol (default "http://localhost:11434")
    -promptPath string
          the filepath to load prompts from (default "./example-prompts.json")
  

For example,

go run main.go -promptPath='/your/path/here'

Tech Stack

Technology Used for
Go Programming language
templ HTML Templating
htmx Render chat messages
redis Store temporary chats
Ollama LLM access
LangChain Integration with Ollama
slog Structured Logging
go-chi Router
httprate Rate limiter
Tailwind CSS CSS Framework
Hero Icons Icons