# Skype - useradd skype passwd skype # x server apt-get install xvfb apt-get install fluxbox x11vnc # skype apt-get install dbus apt-get install libasound2 libqt4-dbus libqt4-network libqtcore4 libqtgui4 libxss1 libpython2.6 libqt4-xml libaudio2 libmng1 fontconfig liblcms1 apt-get install lib32stdc++6 lib32asound2 ia32-libs libc6-i386 lib32gcc1 # wget http://www.skype.com/go/getskype-linux-deb-32 -O skype.deb # dpkg -i skype.deb
# Skype4Py wget 'http://sourceforge.net/projects/skype4py/files/skype4py/1.0.31.0/Skype4Py-1.0.31.0.tar.gz/download?use_mirror=switch' # tar -xzf Skype4Py-1.0.31.0.tar.gz # Skype4py cd Skype4Py-1.0.31.0/ python setup.py install
#!/bin/bash if [[ "$USER" != 'skype' ]]; then echo "Please start this script as skype!" exit 1 fi export DISPLAY=:1 dnb=`dirname "$0"` start() { if [[ `ps aux | grep skype | grep "Xvfb :1" | grep -v grep | wc -l` == '0' ]]; then echo "starting Xvfb" Xvfb :1 -screen 0 800x600x16 & else echo "Xvfb already running" fi if [[ `ps aux | grep skype | grep "fluxbox" | grep -v grep | wc -l` == '0' ]]; then echo "starting fluxbox" sleep 1 fluxbox & else echo "fluxbox already running" fi if [[ `ps -eo pid,user,args | grep skype | awk '{ print $1 " " $3; }' | grep skype | wc -l` == '0' ]]; then echo "starting skype" sleep 2 skype & else echo "skype already running" fi } stop() { if [[ `ps -eo pid,user,args | grep skype | awk '{ print $1 " " $3; }' | grep skype | wc -l` == '0' ]]; then echo "skype is NOT running" else echo "killing skype" killall skype fi "$dnb/start-vnc.sh" stop if [[ `ps aux | grep skype | grep "fluxbox" | grep -v grep | wc -l` == '0' ]]; then echo "fluxbox is NOT running" else echo "Killing fluxbox" killall fluxbox fi if [[ `ps aux | grep skype | grep "Xvfb :1" | grep -v grep | wc -l` == '0' ]]; then echo "Xvfb is NOT running" else echo "Killing Xvfb" killall Xvfb fi } status() { i='3' if [[ `ps aux | grep skype | grep "Xvfb :1" | grep -v grep | wc -l` == '0' ]]; then echo "Xvfb is NOT running" else echo "Xvfb is running" ((i--)) fi if [[ `ps aux | grep skype | grep "fluxbox" | grep -v grep | wc -l` == '0' ]]; then echo "fluxbox is NOT running" else echo "fluxbox is running" ((i--)) fi if [[ `ps -eo pid,user,args | grep skype | awk '{ print $1 " " $3; }' | grep skype | wc -l` == '0' ]]; then echo "skype is NOT running" else echo "skype is running" ((i--)) fi if [[ "$i" == '0' ]]; then echo "OVERALL STATUS: OK" exit 0 fi if [[ "$i" == '1' || "$i" == '2' ]]; then echo "OVERALL STATUS: NOT RUNNING PROPERLY" else echo "OVERALL STATUS: NOT RUNNING" fi exit "$i" } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; status) status ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 esac
#!/bin/bash if [[ "$USER" != 'skype' ]]; then echo "Please start this script as skype!" exit 1 fi export DISPLAY=:1 dnb=`dirname "$0"` start() { "$dnb/start-server.sh" status if [[ "$?" == '0' ]]; then echo "Starting x11vnc" if [[ `ps aux | grep skype | grep "x11vnc -display :1" | grep -v grep | wc -l` == '0' ]]; then x11vnc -display :1 -bg -nopw -listen localhost -xkb else echo "x11vnc is already running!" fi #pid=`ps aux | grep skype | grep "x11vnc -display :1" | grep -v grep | awk '{ print $2; }'` echo " now use on your machine: ssh -L 5900:127.0.0.1:5900 'skype@`hostname`'" echo " and connect to your local port with vncviewer!" else echo "The server doesn't run." echo 'Use "'"$dnb"'/start-server.sh" to start the server' fi } status() { if [[ `ps aux | grep skype | grep "x11vnc -display :1" | grep -v grep | wc -l` == '0' ]]; then echo "x11vnc isn't running" exit 1 else echo "x11vnc is running" exit 0 fi } stop() { if [[ `ps aux | grep skype | grep "x11vnc -display :1" | grep -v grep | wc -l` == '0' ]]; then echo "x11vnc isn't running" else echo "killing x11vnc" killall x11vnc fi } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; status) status ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 esac
./sendim.sh 'USERNAME' 'HELLO WORLD'
./start-vnc.sh stop
./sendim.sh 'USERNAME' 'HELLO WORLD'
#!/bin/bash export DISPLAY=:1 python ~skype/sendim.py "$1" "$2"
import Skype4Py import sys # Create an instance of the Skype class. skype = Skype4Py.Skype() # Connect the Skype object to the Skype client. skype.Attach() user = sys.argv[1] msg = ' '.join(sys.argv[2:]) message = skype.SendMessage(user, msg)
./sendim.sh username message
Name: Skype
Type: Script
Script name: sendim.sh
Enabled: true
Type: Skype
Send to: YOUR_SKYPE_NAME
sudo sshpass -p 'skype' ssh skype@IP_ADDRESS "./sendim.sh '$1' '$2'"
#!python # --------------------------------------------------------------------------------------------- # Python / Skype4Py example that takes a skypename or number from the commandline # and calls it. # import sys import Skype4Py # This variable will get its actual value in OnCall handler CallStatus = 0 # Here we define a set of call statuses that indicate a call has been either aborted or finished CallIsFinished = set ([Skype4Py.clsFailed, Skype4Py.clsFinished, Skype4Py.clsMissed, Skype4Py.clsRefused, Skype4Py.clsBusy, Skype4Py.clsCancelled]); def AttachmentStatusText(status): return skype.Convert.AttachmentStatusToText(status) def CallStatusText(status): return skype.Convert.CallStatusToText(status) # This handler is fired when status of Call object has changed def OnCall(call, status): global CallStatus CallStatus = status print 'Call status: ' + CallStatusText(status) # This handler is fired when Skype attatchment status changes def OnAttach(status): print 'API attachment status: ' + AttachmentStatusText(status) if status == Skype4Py.apiAttachAvailable: skype.Attach() # Let's see if we were started with a command line parameter.. try: CmdLine = sys.argv[1] file = sys.argv[2] except: print 'Missing command line parameter' sys.exit() # Creating Skype object and assigning event handlers.. skype = Skype4Py.Skype() skype.OnAttachmentStatus = OnAttach skype.OnCallStatus = OnCall # Starting Skype if it's not running already.. if not skype.Client.IsRunning: print 'Starting Skype..' skype.Client.Start() # Attatching to Skype.. print 'Connecting to Skype..' skype.Attach() # Make the call print 'Calling ' + CmdLine + '..' global cl cl = skype.PlaceCall(CmdLine) cl.InputDevice( Skype4Py.callIoDeviceTypeFile ,file ) # Loop until CallStatus gets one of "call terminated" values in OnCall handler while not CallStatus in CallIsFinished: pass
#!/bin/bash export DISPLAY=:1 python ~skype/skype_caller.py "$1" "$2"
Source: https://habr.com/ru/post/225103/
All Articles