How hannah-portswigger/totpauthenticate works
Project type and purpose
• This is a Burp Suite Enterprise Edition extension, written in Java, that implements a session-handling action to generate and inject TOTP (time-based one-time password) tokens into outgoing HTTP requests based on user-defined rules.
File structure
• build.gradle / gradlew: the Gradle build & packaging scripts (produces a “fatJar” JAR).
• src/main/java/burp: core Burp extension classes
• MySessionHandlingAction.java – implements the Burp session-handling rule action interface.
• TOTPAuthenticate.java – generates the OTP and applies it to a request.
• src/main/java/userinterface:
• UserInterface.java – handles any UI dialogs or parameter collection inside Burp.
• src/main/java/utils: helper classes
• ConfigurationParser.java – parses the rule string (the /^^…^^/ syntax).
• RuleType.java – enum for HEADER, URL, COOKIE, BODY_PARAM, BODY_REGEX.
• Utilities.java – TOTP generation and common helpers.
• documentation: supporting GIF and docs for usage.
Key insights from README
• Extension registers itself with Burp’s session-handling API.
• Users define a session-handling rule whose “description” field encodes the TOTP secret, rule type, and parameter name.
• The extension parses that description at runtime, generates a TOTP code on each request, and injects it per the rule.
• Built using Gradle; loaded via Burp Enterprise’s extension loader.
Detail
• Break the extension into as many logical components as you see in the file tree (three packages + build artifact).
• Session-handling rule JSON/config as a data artifact.
• How changes to the rule require a reload of the extension in Burp.