
Hello appwrite team, I'm trying to create an appwrite function in python, which executes a command for scanning open ports on a url
Theres a tool for network scanning called "nmap" that allows me to do it, when im in linux i can install it in the terminal using the command:
sudo apt install nmap
And once I have nmap installed, I can run python scripts that use the subprocess library of python to run commands, I'll attach an example of the function I want to achieve and that uses the subprocess thing, so you guys can have an idea:


I don't really know where the appwrite functions run, but looking at the documentation it says that they are in an isolated docker container, my question is how can i install nmap in the docker container or wherever the function is so i can run the command nmap in my python script?
thanks !

Technically, it's not possible to install OS-level dependencies at the moment: https://github.com/appwrite/appwrite/issues/1037. That said...I wonder if you can spawn a sub process to install the program on function start 😅
The containers run in an alpine-based container so you can try to look into installing nmap using alpine's package manager

thanks for the response Steven <:appwriterocket:823996226894692403>
In the github link I see that they modify the dockerfile to add the library there, I still don't quite understand very well, but I'll take a look at that
but do you happen to have guidance on how to install libraries using alpine package manager 🤔 , or any clues that might get me close to spawning a subprocess to install 'nmap' on function start by any chance?

No you can't modify the docker file or provide your own right now. You should 👍 the issue.
Did you try searching for how to do it?

thanks, already liked the issue 👍
Currently im trying to do it this way:
I'll let you know if I succeed once I run the function

Apparently it worked! I made it return all the installed libraries and among them is nmap
the response:
{"installed_packages":["musl","busybox","alpine-baselayout","alpine-keys","ca-certificates-bundle","libcrypto1.1","libssl1.1","libretls","ssl_client","zlib","apk-tools","scanelf","musl-utils","libc-utils","ca-certificates","tzdata","ncurses-terminfo-base","ncurses-libs","libbz2","sqlite-libs","libffi","gdbm","xz-libs","expat","libintl","libtirpc-conf","krb5-conf","libcom_err","keyutils-libs","libverto","krb5-libs","libtirpc","libnsl","libuuid","readline",".python-rundeps","libgcc","lua5.3-libs","libpcap","pcre","libssh2","libstdc++","nmap"]}
I have not tried running nmap yet but for now It seems that the library was installed 👍

Hi @ianmont - is this solved? do you need more help with this?

its solved

[SOLVED] Need help installing a script in a Appwrite Function
Recommended threads
- Failed to verify JWT. Invalid token: Exp...
Hi I am trying to call a function from my mobile app, but I am receiving "Invalid token expired." My code looks more or less like this ```ts // from my app ...
- How do I pair Polar.sh + Hono + Appwrite...
This is what all it required by polar to see the webhook data. Managing with webhook data is not an issue, but how do I pair this all with appwrite functions st...
- The function became slower after being e...
I used the Python SDK and set `xasync=True` in `create_execution`, expecting it to execute quickly on another worker. However, the execution ended up taking sev...
