Join Today
+ Reply to Thread
Results 1 to 8 of 8
  1. #1

    Default Simple HTTP Daemon ---- PKG for A1200i

    I think others may have already made something like this. In this case, here one more.

    A friend said few days ago that my mobile phone is not real linux. And that if it is why can´t I turn it into a web server? "Isn´t this one of the most used application of linux?"

    Well, I hope we are now close to make native/pre-installed applications to freely open connections the way it should and not the way motorola wants. Then this should be a useful application.

    For now, it is a proof-of-concept and something you can show to your friends and ask if their phone can do something similar
    You can request pages and scripts from your PC using USBLAN. You can try a java midp web browser like minuet (it is not user friendly) with fake_dsmForA1200. Opera can't access localhost. OperaMini can´t access the phone because it tries to access server.operamini.com.
    (you can erase MinuetPdaV314#Settings.db and MinuetPdaV314#Settings.idx to use it after the trial expires)

    This SHTTP is based on http://shttpd.sourceforge.net/

    This HTTPD can run CGI scripts but keep in mind that we are running on a phone not a multi-processed server - try to run only simple programs with small memory and processor usage.

    Just install it, reboot the phone, tap the icon. I used the traditional 2 mid sounds (one on start and the other on stop). Then open the browser on the PC and try http://192.168.16.2/ and http://192.168.16.2/scripts.
    the ip address depends on your usblan driver.

    the web root directory is pointing to /mmc/mmca1 (the transflash card). To reduce the extent of damage you can cause on our phone it runs under the user EZX.

    When you run for the first time it will create the directory /mmc/mmca1/scripts and copy some CGI scripts to test and inspire others to make more scripts and share:

    1) ls.cgi --- run ls -le just to know that we can run something.
    2) df.cgi --- runs df -h to know how much storage we still have free
    3) psle.cgi --- what is running now?
    4) sysinfo.cgi --- displays some information about our Ming
    5) command.html / command.cgi --- run the requested command

    If you want to run as root and see the root of the file system (/) you can find the shttpd.lin file and uncomment the line AFTER the line saying this:
    # arguments in the case you want to run as root and show everything
    and comment out the line AFTER
    # start as ezx and show transflash

    If you want to run shttpd with other parameters then here are the command line parameters:

    -A htpasswd server_name user_name user_password
    Edit the passwords file. Functionality similar to Apache's
    htdigest utility.

    -C file (cgi_interpreter file)
    Force file to be a CGI interpreter for all CGI scripts. Default:
    none.

    -D 0|1 (list_directories 0|1)
    Disable directory listing. Default: enabled.

    -I 0|1 (inetd_mode 0|1)
    Enable inetd mode. Default: disabled.

    -N realm (server_name realm)
    Authorization realm. Default: ``mydomain.com''.

    -P file (global_htpasswd file)
    Location of global passwords file. Per-directory .htpasswd files
    are ignored, if this option is set. Default: not set.

    -U file (put_auth file)
    PUT and DELETE passwords file. This must be specified if PUT or
    DELETE methods are used. Default: none.

    -V string (cgi_envvar string)
    Pass additional environment variables to the CGI script. These
    must be comma-separated list of var=val pairs, like this:
    "VAR1=VAL1,VAR2=VAL2". Default: not set.

    -a string (aliases string)
    Attach directories (even those outside document_root) to URIs.
    The string must be comma-separated list of var=val pairs, like
    this: "/etc/=/my_etc,/tmp=/my_tmp". Default: not set.

    -c string (cgi_extension string)
    CGI filename pattern. For every requested file, shttpd uses the
    pattern to figure out whether to return the file content, ot run
    the file as CGI application. Default: ``.cgi''.

    -d directory (document_root directory)
    Location of the WWW root directory. Default: working directory
    from which shttpd has been started.

    -e file (error_log file)
    Error log file. Default: not set, no errors are logged.

    -l file (access_log file)
    Access log file. Default: not set, no logging is done.

    -m file (mime_types file)
    Location of mime types file. Default: not set, builtins are used.

    -p port (listen_port port)
    Listening port. Default: 80 for non-SSL and 443 for SSL mode.

    -s pem_file (ssl_certificate pem_file)
    Location of SSL certificate file. Default: not set.

    -u login (runtime_uid login)
    Switch to given user ID after startup. Default: not set
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2007
    Location
    Belo Horizonte, MG, Brazil
    Posts
    375

    Default

    Very cool CLOVIS.

  3. #3

    Default

    yes, this is for curiosity. Today it has few pratical use.
    A real shell like SSHD is better.
    And SSHD is secure.
    Anyway SMBD already opened the doors to free access to your phone from the pc and there are people using simple telnet.

  4. #4

    Default

    Any chance to get it for a780?

    It still work I thing. I can get into mmc over http. but its crosscompiled for a1200, right?

  5. #5

    Default

    Quote Originally Posted by GreenHorn
    Any chance to get it for a780?

    It still work I thing. I can get into mmc over http. but its crosscompiled for a1200, right?
    it is cross compiled for arm.

    Probably it will run (the binary). It does not use any ezx library only standard.

    I don't know about the PKG format for A780 (is it the same?) and file system (SD Card isn´t in /mmc/mmca1, is it?).

    If you have a terminal shell then you can unzip the shttp.pkg, copy the file "shttpd" to your phone and try the command:

    $ shttpd -I 0 -e shttpd.err.txt -l shttpd.access.txt -d "/"

    and then request a page from your desktop pc.

    look at the shttpd.lin for examples of command line options usage.

  6. #6

    Default

    of course, all the dependencies apply: you need usblan/usbnet

  7. #7

    Default

    Yes. I renamed it to mpkg and it works.

    Can I get in the root directory also??

  8. #8

    Default

    Quote Originally Posted by GreenHorn
    Yes. I renamed it to mpkg and it works.
    Can I get in the root directory also??
    yes, you can find the install directory (in A1200 it is /mmc/mmca1/.system/QTDownload/shttpd) and change the script shttpd.lin.

    in the first post you can find some tips on what you can try to change in this file.


 
+ Reply to Thread

Similar Threads

  1. Sound-Daemon for MotoMagx
    By gorgoyle in forum Bounty Projects
    Replies: 2
    Last Post: 07-01-2008, 07:31 AM
  2. APP: Simple Clock.pkg
    By dellsonic in forum E6 General Chat
    Replies: 11
    Last Post: 01-22-2008, 08:43 PM
  3. Help: "http gateway timed out http://my.yahoo.com"
    By ssymoto in forum A1200 General Chat
    Replies: 1
    Last Post: 08-15-2007, 05:49 PM
  4. [APP] PKG apps - various PKG utilities
    By superfly86 in forum A1200 Applications
    Replies: 5
    Last Post: 06-22-2007, 11:07 PM
  5. MediaNET limitted only to HTTP ?
    By acidscan in forum A1200 General Chat
    Replies: 2
    Last Post: 09-22-2006, 03:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Single Sign On provided by vBSSO

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1