@@ -8,16 +8,18 @@ import { AIRequest } from '../../types';
88// Import attack payloads with proper path resolution for packaged apps
99const getPayloadsPath = ( ) => {
1010 if ( app . isPackaged ) {
11- // In packaged app, use the resources directory
12- return path . join ( process . resourcesPath , 'app.asar' , 'public/ assets/ payloads/ all-attack-payloads.json' )
11+ // In packaged app, use the asar path
12+ return path . join ( process . resourcesPath , 'app.asar' , 'public' , ' assets' , ' payloads' , ' all-attack-payloads.json') ;
1313 } else {
1414 // In development, use the normal path
15- return path . join ( __dirname , '../../../public/assets/payloads/all-attack-payloads.json' )
15+ return path . join ( __dirname , '../../../public/assets/payloads/all-attack-payloads.json' ) ;
1616 }
1717}
1818
19- const payloadsPath = getPayloadsPath ( )
20- const attackPayloads = JSON . parse ( fs . readFileSync ( payloadsPath , 'utf8' ) )
19+ const payloadsPath = getPayloadsPath ( ) ;
20+ console . log ( 'Payloads path:' , payloadsPath ) ;
21+ console . log ( 'Exists:' , fs . existsSync ( payloadsPath ) ) ;
22+ const attackPayloads = JSON . parse ( fs . readFileSync ( payloadsPath , 'utf8' ) ) ;
2123
2224export interface AttackPayload {
2325 id : string
@@ -293,5 +295,9 @@ export class AttackEngine extends EventEmitter {
293295 ipcMain . handle ( 'get-test' , ( _event , testId : string ) => {
294296 return this . tests . get ( testId )
295297 } )
298+
299+ ipcMain . handle ( 'get-attack-payloads' , async ( ) => {
300+ return attackPayloads ;
301+ } ) ;
296302 }
297303}
0 commit comments