Skip to Main Content
The Language of Deception
book

The Language of Deception

by Justin Hutchens, Stuart McClure
December 2023
Intermediate to advanced content levelIntermediate to advanced
400 pages
8h 58m
English
Wiley
Content preview from The Language of Deception

Appendix EAttack Optimization with Monte Carlo Simulations

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 openai
 
openai.api_key = '' # Add OpenAI API Key Here
model_test = str(1)
 
def updateTranscript(msg, transcript):
    #print(msg)
    transcript = f'{transcript}{msg}'
    return transcript
    
def 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': ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

The Language of Deception

The Language of Deception

Justin Hutchens

Publisher Resources

ISBN: 9781394222544Purchase Link