If you need access from web browser, there is an plugin for apache that allows it. Giving you also some good statistics too.
Posts by supermariocs
-
-
Oscam has very good caching system. No need for CSP at all!
Why would I want to keep ECM's older then one minute? They change anyway. CPS is caching ECM's for days and weeks. What for?? -
My script has nothing to do with size of Oscam.log!! It is only reading the log and not writing to it.
However, there is simple solution for your problem. Edit your oscam.conf file and limit the maximum size of the log:So if you want to limit maximum size of the log to 512 Kilobytes, you should write this line to oscam.conf:
Enjoy!
-
Just make sure you use FTP in passive mode!!
-
OK
Here is the plan:
- Record last 10 minutes of debug file in intervals of 6 hours (can be changed to 3 hours).
- Rotate always latest 2 files and erase older ones.Use filter to extract only user data (username and sid).
- Compare two files and see if last watched channel (sid) is exactly the same in both files (for each user separately).
- If lines are exactly the same, this means user has been watching the same channel for at least 6 hours.
- For users that have been watching the same channel, find their IP and send it to iptables (DROP).
(iptables need to be flushed 2-3 minutes before we execute the compare&ban script. So we can test again those users that have been previously banned)Possible problems:
- Need to find a simplest way to extract IP address from user name. CCcam debug contain this data, but it can be very old and buried deep inside the log. For example, if user connected on 18.8.2011 and stayed online till 20.8.2011 without disconnecting, then this could be problematic to find.
I was thinking to use web interface (16001) and get the IP from there.
- If the user watched channel 1 when we first save the log, and then changed to other channels but again returned to channel 1 on next sampling time, he will get banned although he did changed channels in the middle.Any ideas, help or improvements are WELCOME!!
:30_002: -
Well... we can make it work if you really want. Even this 3 hours zapping request. It will require to join forces and start writing the script since I dont have enough time to write it alone.
We can monitor debug file and extract data from there. If user is watching the same channel for 3 hours, we ban him on IP tables.
And then release him for 10 minutes and if he's still on the same channel, ban again. Something like fail2ban script. -
Hello Linux lovers
I decided to write a small tutorial and show you my method of starting and stopping the Oscam in my Linux. And also a script that will keep it alive in case it crashes or shows one of 2 known errors (ins_40 and deadlock).
You are free to change the script and improve it. I would be glad to implement some new stuff to it. I am using this method for long time and it works great for me!!
Paths and file names are used as sample only. You can change it.
This was tested on Debian Linux, but it should work on others too.Step 1:
Put your oscam binary to this path and name it like this:
And put your all config files to this same folder:
Don't forget to give 755 permissions to oscam.x86:
Step 2:
Create a script that will easily control start/stop of your oscam and name it oscript. I am using vi as editor. You can use any editor you wish:
and then paste this text to the file:
Bash
Display More#!/bin/sh CAMNAME="Oscam Server" # end # This method starts Oscam start_cam () { pkill -9 oscam.x86 sleep 2 /emu/oscam/oscam.x86 -c /emu/oscam & } # This method stops Oscam stop_cam () { pkill -9 oscam.x86 } case "$1" in start) echo "[SCRIPT] $1: $CAMNAME" start_cam ;; stop) echo "[SCRIPT] $1: $CAMNAME" stop_cam ;; restart) echo "Restaring $CAMNAME" stop_cam sleep 7 start_cam ;; *) "$0" stop exit 1 ;; esac exit 0
* I prefer to run kill command before starting the oscam. Just in case oscam is already running when you execute start command.
Don't forget to give 755 permissions to oscript:
Create symbolic link so you can easily use this script from any location:
Now you can simply start, stop or restart oscam from any directory by simply typing:
Step 3:
Now you need a script that will control your Oscam and keep it running all the time. Create the script and name it check_os:
Don't forget to give 755 permissions to check_os script:
and then paste this text to the file:
Bash
Display More#!/bin/bash if ! ps x |grep -v grep |grep -c /emu/oscam/oscam.x86 >/dev/null then oscript start echo `date "+%d/%m/%y %R process was not working"` >> /var/log/oscam_restart_log # This part above will check if there is NO oscam process running. # And if this condition it truth, it will start it and write to log. # Log entry will contain time stamp and reason of execution (process not working) # If first condition in not truth (oscam was running), go further to next condition. elif tail -8 /var/log/oscam.log |grep -v grep |grep -c ins40 >/dev/null then oscript restart echo `date "+%d/%m/%y %R ins40 error detected"` >> /var/log/oscam_restart_log elif tail -8 /var/log/oscam.log |grep -v grep |grep -c deadlock >/dev/null then oscript restart echo `date "+%d/%m/%y %R deadlock error detected"` >> /var/log/oscam_restart_log # Those 2 conditions will look for 2 common errors in Oscam: "ins40" and "deadlock" # If last 8 lines of your oscam.log contain any of those errors, it will restart oscam. # Log entries will include the exact reason of restart. # ins40 error is random error that will keep oscam running but no CWs returned. # deadlock is older error that appear if you use CCcam protocol in oscam.server else echo "ok" # If oscam passes all conditions and all is OK, it will simply echo "ok" :-) fi # ENJOY - supermariocs
As you can see in the text, my oscam log is located in /var/log directory.
This means that you need this line in your "oscam.config" file:Also, every restart by this script will be recorded in this file:
It will include time stamp and reason for restart so you can have trace of it.Step 4:
Now you need a crontab entry that will run all the time in the background and check your oscam status. I prefer to run it every 15 minutes, but you can change it of course:
and add this line:
Step 5:
Add this line to your startup file. In Debian it is "/etc/rc.local"
Step 6:
ENJOY!!!
-
Just note that this will disconnect and then reconnect all your existing peers and lines.
The best is to make offline changes to your CCcam.cfg in PC and upload this file to some other folder (for example /var/etc/temp) and then once a day (few minutes before your daily reboot), run the script that will replace the working CCcam.cfg with this one from temp. Same script will move the file from temp to some other location and rename it for future reference and backup (for example CCcam.cfg-18.8.2011).
Enjoy! -
You can write your own script to make it work even in Cccam.
I think I have it somewhere. Will post when I find. But this is the procedure:
- run wget in crontab to download activeclients list from 16001 and save the list (filename1)
- run again the same thing after x period of time you wish and save it as (filename 2).
- repeat those actions in rotation so you will delete the oldest file and create new one all the time.
- clean the files from unnecessary fields and leave only client name, IP and channels he's watching
- compare the files and look for clients that have identical lines (watching same channels).
- cut their IP and send it to Iptables for a ban. Just make sure you flush the IP tables at least once a day.
- you can also cut the sid and ban from him only the specific channel through CCcam.cfg but this demands much more work since you need to find his F line and add this SID in specific location in CCcam.cfg. I wouldnt mess with this thing. Simple IP ban for limited time would do the job.
CHEERS -
As far as I know, this 0624 CAID works fine in CS?!
-
Not much you can do with regular tools like Oscam,CCcam...Some special data needs to be extracted and very few servers in the world have it.Meanwhile, enjoy your SD! :>