Hi Hernry,
When an active response is executed, the binary receives the json alert via STDIN. In your code you must parse the JSON of the alert and find for the field where the ip is stored.
On the other hand to be able to obtain the attacker's IP, the alert must contain the attacker's ip, that is to say, that the log that generated the alert contains the ip and this was decoded and stored in a field (usually srcip).
I think you will find our documentation useful.
Here you will find how active response works and
here you will find how to create custom active response.
I hope you find this useful