A simple shell script to automatically log in and approve sessions on the IIT Madras Netaccess portal.
Ideal for users who want uninterrupted network access without manually logging in every day.
- Automatically logs in to netaccess.iitm.ac.in
- Approves sessions for 1 hour or 1 day
- Maintains session cookies for stability
- Logs all activity to a specified log file
- Supports automation via crontab or /etc/rc.local
Edit the script and update the configuration section at the top:
# --- Config ---
USER="roll_no" # Your Roll Number / Username
PASS="password" # Your Netaccess password
IP="x.x.x.x" # Your device’s IP address
ROOM="optional" # Room number (optional)
DURATION="2" # 1 = 1 hour, 2 = 1 day
COOKIE_JAR="/root/netaccess_cookies.txt"
LOG="/tmp/netaccess.log"Tip: If you get an error saying could not find IP of netaccess, add this entry to your /etc/hosts file:
{ip} netaccess.iitm.ac.inYou can find the {ip} by running:ping netaccess.iitm.ac.in
Manual Run
sudo sh /root/netaccess.sh
Automate with Crontab
Run every day at 9 PM:
crontab -e
and add:
0 21 * * * /root/netaccess.sh >/dev/null 2>&1
Run on Boot (Recommended)
Since @reboot is not enabled on OpenWRT, use /etc/rc.local:
sleep 10
sh /root/netaccess.sh >/dev/null 2>&1All logs are stored at:
/tmp/netaccess.log
You can check it anytime using:
cat /tmp/netaccess.log
Requires curl to be installed:
opkg update opkg install curl