جارى التحميل
  • سكربت SimpleHTTPServer

    السلام عليكم،

    اثناء البحث في ارشيف السكربتات لديّ لفت انتباهي هذا السكربت فقلت لما لا اشارككم اياه، لا أدري ان كان مر مثله في المنتدى المهم دور السكربت هو انشاء خادم البايثون SimpleHTTPServer بعد تشغيله ستظهر رسالة بواجهة zenity بها عنوان الأي بي الخارجي مع المنفذ 8000 تختار منها تشغيل الخادم.

    المجلد الإفتراضي للخادم هو الذي يوجد به السكربت، للولوج له نتكب في المتصفح
    أو عنوان الأي بي الخارجي مع المنفذ 8000 ستظهر ايقونة جنب الساعة يمكن من خلالها إيقلف الخادم.

    لم أعد أذكر مصدر السكربت حتى تبين انه من أحد أعضاء منتدى اوبنتو الفرنسي.



    #!/bin/bash

    #
    # ------------------------------------------------------------------
    #    made by sputnick in da FreAkY lApPy lAb (c) 2009
    #    gilles.quenot <AT> gmail <DOT> com
    #     Idea from smecher.
    #
    #    This program is free software; you can redistribute it and/or
    #    modify it under the terms of version 2 of the GNU General Public
    #    License published by the Free Software Foundation.
    #       (see http://www.gnu.org/licenses/gpl.html).
    # ------------------------------------------------------------------
    #   ,,_
    #  o"  )@
    #   ''''
    # ------------------------------------------------------------------
    #
    # vim:ts=4:sw=4
    #
    #
    # Version 0.2
    #

    #  Script permettant de lancer un serveur web en dialog zenity a la volee dans le dossier courrant.
    #  Il affiche les IP:PORT interne et externes qui seront disponibles.
    #  ( Si vous etes derriere un routeur, il faut le configurer pour que le port 8000
    #     soit forwarde vers votre adresse IP locale.
    #
    #  Questions et infos : http://forum.ubuntu-fr.org/viewtopic.php?id=364489

    #  Prerequis:
    #    zenity


    iface=eth0 # Votre interface reseau : iface=ra0, iface=wlan0 etc...

    # ne plus modifier
    # -----8<--------------------------------------------------------------------------------
    DIR=${1:-$PWD}

    if 
    nc --w2 localhost 8000then
        zenity 
    --error --title="error:" --text="Le port localhost:8000 bind deja !\n\nSeeYa..."
        
    exit 1
    fi

    zenity 
    --question --text="\"$DIR\"
    sera accessible dans votre navigateur a l'adresse:

    public: $(wget -O - -q http://sputnick-area.net/ip):8000
    prive: $(ifconfig 
    $iface | awk '/inet/{gsub(" *inet add?r:","");print $1;exit}'):8000

    Continuer?" 
    || exit 0

    python 
    -m SimpleHTTPServer pro=$!

    while 
    true; do
        
    zenity --notification  --text="Appuyer pour eteindre le serveur"

        
    if zenity --question --title="Confirmation?" --text="T'es sur ? Ca va trancher cherie !"then
            kill $pro
            
    exit $?
        
    fi
    done 
    This article was originally published in forum thread: سكربت SimpleHTTPServer started by محمد.أمين View original post