# Calling external scripts on extracted files

**URL:** <https://community.zeek.org/t/calling-external-scripts-on-extracted-files/5046>\
**Category:** Zeek\
**Created:** [October 4, 2017, 12:54pm UTC](https://community.zeek.org/t/calling-external-scripts-on-extracted-files/5046 "2017-10-04T12:54:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vikram\_Basu](https://avatars.discourse-cdn.com/v4/letter/v/65b543/32.png) [@Vikram\_Basu](https://community.zeek.org/u/Vikram_Basu)\
**Post date:** [October 4, 2017, 12:54pm UTC](https://community.zeek.org/t/calling-external-scripts-on-extracted-files/5046/1 "2017-10-04T12:54:59Z")

</div>

Hi,

I am using the bro file-extraction script from the bro-pkg manager and want to run a python script as soon as the file is completely extracted.

Currently I am calling the script using the Bro Exec::run command after modifying the script but often times the script is running before the file has finished extracted and is failing as a result.

How can I make it so that Bro calls the script after file has already been extracted?

I thought maybe using file\_state\_remove would help but even in that case I am getting  
/Input::READER\_RAW: Child process exited with non-zero return code 127

which I am assuming means the script was run before the file as truly extracted?

Any advice would be much appreciated.

Regards

Vikram

---

<div class="post-metadata">

**Author:** ![Hosom\_Stephen\_M](https://avatars.discourse-cdn.com/v4/letter/h/d26b3c/32.png) [@Hosom\_Stephen\_M](https://community.zeek.org/u/Hosom_Stephen_M)\
**Post date:** [October 4, 2017, 1:24pm UTC](https://community.zeek.org/t/calling-external-scripts-on-extracted-files/5046/2 "2017-10-04T13:24:45Z")

</div>

Vikram,

I'm the author of the package that you're using. Happy to help!

I don't know why it is precisely that your script is not working, however, I have good examples of how to do this type of activity within the plugin.

Check out the file store-files-by-md5.bro withing the plugins directory.

This script uses the mv command to move files and rename them based on their hash once Bro finishes extracting them and is a good example of how to perform an action on a file once it has been extracted "the right way".

Please let me know if you have any issues... You may find that I am more responsive to the issues page for the project on GitHub.

Thanks,

Stephen

---

<div class="post-metadata">

**Author:** ![Vikram\_Basu](https://avatars.discourse-cdn.com/v4/letter/v/65b543/32.png) [@Vikram\_Basu](https://community.zeek.org/u/Vikram_Basu)\
**Post date:** [October 4, 2017, 1:41pm UTC](https://community.zeek.org/t/calling-external-scripts-on-extracted-files/5046/3 "2017-10-04T13:41:07Z")

</div>

Awesome. Thanks, I’ll check it out.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/zeek/original/1X/f09d732bc2cc7c7cc7e35db67cf4e1d5233ce7a7.png) [@system](https://community.zeek.org/u/system)\
**Post date:** [May 6, 2022, 3:45pm UTC](https://community.zeek.org/t/calling-external-scripts-on-extracted-files/5046/4 "2022-05-06T15:45:19Z")

</div>

Closed on May 6, 2022, 3:45pm UTC


