December 2023
Intermediate to advanced
400 pages
8h 58m
English
As discussed in Chapter 7, “Weaponizing Social Intelligence,” Monte Carlo simulations can be executed by using an LLM service to play the roles of both the social engineering system and the target victim. By crafting instructions for each, it is possible to tailor and optimize attacks toward specific types of targets. The examples provided will use the following boilerplate Python code. While iterating through the Monte Carlo simulations to attempt to optimize automated social engineering attacks, we will primarily be updating the social engineering instructions, the target victim instructions, and the initial message. I have highlighted those in the following code for reference:
import openaiopenai.api_key = '' # Add OpenAI API Key Heremodel_test = str(1)def updateTranscript(msg, transcript):#print(msg)transcript = f'{transcript}{msg}'return transcriptdef updateConvo(transcript):if b1_convo[len(b1_convo)-1]['role'] == 'user':r = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=b1_convo)reply = r['choices'][0]['message']['content']b1_convo.append({'role': 'assistant','content': reply})b2_convo.append({'role': 'user','content': reply})return updateTranscript(f'\nSocial Engineer: {reply}', transcript)elif b2_convo[len(b2_convo)-1]['role'] == 'user':r = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=b2_convo)reply = r['choices'][0]['message']['content']b2_convo.append({'role': ...