Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - winger

#1
It's just an idea.

We know .Net does not provide a standard DLL for other languages.

Should we  write a DLL to complete the call to.NET and  provide the interface for other languages ?

Anyone idea?
#2

;#t2.lsp
(set 'ARGS (main-args))
(define (get-arg argname  '_result)
    (let (ix (find argname ARGS))
        (and ix (pop ARGS ix))
        (if (catch (ARGS  ix) '_result)
            (and (pop ARGS ix) _result)
            nil
        )
    )
)


(constant 'EXECUTE_PATH "/usr/bin/newlisp")

(constant 'ARG_SECOND "t2.lsp")

(constant 'TIME_CLOCK 4000)


(constant 'DEAD (get-arg "--dead"))

(when DEAD
    (write-file (string "t2_txt." (date-value)) (string (date-value)))
    (exit)
)

(while (not DEAD)
    (sleep 2000) ;; Two line code . actually only sleep 2 seconds !!!
    (sleep 2000) ;; Without this will generate an error !!!
    (println "Sleep... " TIME_CLOCK )
    (if CPID (destroy CPID))
    (set 'CPID (process  (join (map string (list EXECUTE_PATH  ARG_SECOND "--clock" TIME_CLOCK  "--dead 4free"  )) " ") ))
    (println "CPID :--> " CPID )
    (println (join (map string (list EXECUTE_PATH  ARG_SECOND "--clock" TIME_CLOCK  "--dead 4free"  )) " "))
    ;(sleep 2000)  ;;Here is also possible to insert the code.
)
(exit)


t2.lsp is A self-calling script.

anyboday have idea?



And How to suppress output from return values from
Quote load
function?
Quotesilent
 function no effect.
#3
Sometimes we need get  http status code .

But get-url  only return 404 status code.


Quote
> (setf xo2 (get-url "http://www.baidu.com/link?url=kX6MGJqjJ4zBBpC8yDF8xDhzsTii46BoCipLx6xJ2t3626ZBIWUltBgpQyK">http://www.baidu.com/link?url=kX6MGJqjJ ... WUltBgpQyK">http://www.baidu.com/link?url=kX6MGJqjJ4zBBpC8yDF8xDhzsTii46BoCipLx6xJ2t3626ZBIWUltBgpQyK" "list debug" 10000 ))

GET /link?url=kX6MGJqjJ4zBBpC8yDF8xDhzsTii46BoCipLx6xJ2t3626ZBIWUltBgpQyK HTTP/1.1

Host: http://www.baidu.com">www.baidu.com

User-Agent: newLISP v10406

Connection: close



GET /x_8ce9a63e HTTP/1.1

Host: shenzhen.8684.cn

User-Agent: newLISP v10406

Connection: close



("Server: nginxrnDate: Mon, 15 Apr 2013 06:44:58 GMTrnContent-Type: text/htmlrnContent-Length: 24308rnLast-Modified: Mon, 15 Apr 2013 04:46:20 GMTrnConnection: closernETag: "516b861c-5ef4"rnAccept-Ranges: bytesrnrn"

 [text] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <meta http-equiv="mobile-agent" content="format=xhtml; url=http://m">http://m.




Request process:


Quote
Request :

GET /link?url=kX6MGJqjJ4zBBpC8yDF8xDhzsTii46BoCipLx6xJ2t3626ZBIWUltBgpQyK HTTP/1.1

User-Agent: Opera/9.80 (X11; Linux i686) Presto/2.12.388 Version/12.15

Host: http://www.baidu.com">www.baidu.com

Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1

Accept-Language: zh-CN,zh;q=0.9,en;q=0.8

Accept-Encoding: gzip, deflate

Cookie: bdshare_firstime=1358503823802; PMS_Cache=1363532395084; BDRCVFR[1YH7NbrCiJt]=mk3SLVN4HKm; BDRCVFR[4h1EqrJ1R8f]=VvV1HAYMbPTULK-Th7WpA-8mi4WUvY; BAIDUID=F213C9E903147ACDC369E0D0DA6B84D1:FG=1; BAIDU_WISE_UID=bd_1355838599_729; BDUT=l09eF8F6C6A8ED1A60168F8E527DBCD7548213d05aacbdee; H_PS_PSSID=2218_1439_1944_1788_2222

Connection: Keep-Alive





Respone:

HTTP/1.1 302 Found

Date: Mon, 15 Apr 2013 06:47:49 GMT

Server: Apache

Location: http://shenzhen.8684.cn/x_8ce9a63e">http://shenzhen.8684.cn/x_8ce9a63e

Cache-Control: max-age=86400

Expires: Tue, 16 Apr 2013 06:47:49 GMT

Content-Length: 218

Connection: Keep-Alive

Content-Type: text/html; charset=iso-8859-1



<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">........
#4
first:

I have wirted a multiporcess scanner.

i use ten process.

All of them blocked sometimes later!!!



(define (check_path host , url url2 result str  socket)
            (if-not (starts-with host "http://") (setf url2  (string "http://" host)))
            (dolist (port portlst)
                (when (and
                            (setf socket (net-connect host (int port) TIMEOUT)) ;have question
                            (close socket)
                            (find "^ERR: server code 404" (get-url (append url2 ":" port FOOLCHECK) ) 1)
                            )
                            (dolist (path ALLPATH)
                            (setf url (append url2 ":" port  path));notice here
                            ;(setf result (get-url url  "list debug"TIMEOUT AGENT))
                            (setf result (get-url url  TIMEOUT AGENT))
                            (if-not (find "^ERR: Operation timed out" result 1)
                                (if-not (find "^ERR.*n*" result 1)
                                    (and
                                    (println "rnrn----------------------Bingo----------------------rn" url "rn")
                                    (set 'str  (string  "<a href="" url " ">" url "</a>        200 </br>"))
                                    (write FID_R  str)
                                    )
                                   ; (
                                    ;can add other err log ex:503 forbiden
                                    ;)
                              )
                              (and
                                (println "rnrn----------------------Time out----------------------rn" url "rn")
                                (set 'str  (string  "<a href="" url "">" url "</a>        time out </br>"))
                                (write FID_R  str)
                              )
                        )
                    )

                )
            )
)
(set 'pnum (min pnum allipnum))
 (dotimes (n pnum)
    (spawn (sym (allip pcount)) (brute_path  (allip pcount)))
    (inc pcount)
    (println "")
)

(define (report pid)
    (semaphore sid -1)
    (when (< pcount allipnum)
        (spawn (sym (allip  pcount)) (check_path (allip pcount)))
    )
    (inc pcount)
    (semaphore sid 1)
)


Quote
i strace process find :
Quote
then always thus:



!netstat -anp  -c 1| grep newlisp



tcp        1      0 192.168.51.103:46220    115.36.76.90:80        CLOSE_WAIT  9771/newlisp    

tcp        0      0 192.168.51.103:52180    113.17.16.64:8000    ESTABLISHED 23789/newlisp  

tcp        1      0 192.168.51.103:46192    115.26.76.90:80        CLOSE_WAIT  9771/newlisp    

tcp        1      0 192.168.51.103:52520    115.26.76.90:80        CLOSE_WAIT  9771/newlisp    

tcp        0      0 192.168.51.103:35091    121.1.45.14:8080      ESTABLISHED 24664/newlisp  

tcp        1      0 192.168.51.103:46187    115.36.76.90:80        CLOSE_WAIT  9771/newlisp    

tcp        0      0 192.168.51.103:48741    115.8.11.11:8001    ESTABLISHED 24305/newlisp  

tcp        0      0 192.168.51.103:36782    58.9.19.181:80       ESTABLISHED 24934/newlisp  

tcp        0      0 192.168.51.103:32917    121.4.45.10:8002      ESTABLISHED 24575/newlisp  

tcp        0      0 192.168.51.103:37811    58.24.19.13:8080     ESTABLISHED 24926/newlisp  

tcp        1      0 192.168.51.103:46200    115.23.76.90:80        CLOSE_WAIT  9771/newlisp    

tcp        0      0 192.168.51.103:44936    121.14.45.12:80        ESTABLISHED 24607/newlisp  

tcp        0      0 192.168.51.103:45617    115.28.1.206:80      ESTABLISHED 24423/newlisp  

tcp        0      0 192.168.51.103:41055    121.1.45.121:8002      ESTABLISHED 24596/newlisp  

tcp        0      0 192.168.51.103:43155    121.4.45.240:80        ESTABLISHED 24720/newlisp  



strace -v -p  24664

select(6, [5], NULL, NULL, {0, 1000})   = 0 (Timeout)

select(6, [5], NULL, NULL, {0, 1000})   = 0 (Timeout)

select(6, [5], NULL, NULL, {0, 1000})   = 0 (Timeout)

.

.

.






second:


(set 'socket (net-connect "www.baidu.com" 80))
(net-send socket "GET /rnrn")
(net-receive socket buffer 10000);have issuses
(println buffer)
(exit)
#5
create a empty file a.lsp


winger@winger$ newlisp a.lsp http://www.google.com/bank.html

ERR: problem accessing file : "ERR: server code 404: HTTP/1.1 404 Not Foundrn<!DOCTYPE html>n<html lang=en>n  <meta charset=utf-8>n  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">n  <title>Error 404 (Not Found)!!1</title>n  <style>n    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{back


so xxxxx.

I can not use the parameter contains "http://"  because newlisp automatically get url data.

Maybe we can set special parameters to deal with the  problem. ?
#6
We need to submit code and search script code in a very convenient place.

These codes can be very easily applied to the actual work.

Now everyone each write their own.

I think we need a CPAN or an appstore.

http://search.cpan.org/">//http://search.cpan.org/
#7
I just parse nmap scan result.

But i find function (ref)  will broken when it process big data. :(

Following codes can work if xo isn't too large.

(setf xo
'((host ((comment "")) (status ((state "up"))) (address ((addrtype "ipv4") (vendor
    "")
   (addr "111.11.11.4")))
 (hostnames)
 (ports (extraports ((count "999") (state "filtered"))) (port ((protocol "tcp") (
     portid "80"))
   (state ((reason "syn-ack") (state "open") (reason_ttl "114")))
   (service ((product "Apache httpd") (name "http") (extrainfo "(Win32)") (version
      "2.2.17")
     (conf "10")
     (method "probed")))))
 (os (portused ((state "open") (portid "80") (proto "tcp"))) (osmatch ((line "44168")
    (name "Microsoft Windows Server 2003 SP1 - SP2")
    (accuracy "100"))
   (osclass ((type "general purpose") (osfamily "Windows") (vendor "Microsoft") (
      osgen "2003")
     (accuracy "100"))))
  (osmatch ((line "50322") (name "Microsoft Windows XP SP2") (accuracy "100")) (osclass
    ((type "general purpose") (osfamily "Windows") (vendor "Microsoft") (osgen "XP")
     (accuracy "100"))))
  (osmatch ((line "50937") (name "Microsoft Windows XP SP2 or Windows Server 2003 SP2")
    (accuracy "100"))
   (osclass ((type "general purpose") (osfamily "Windows") (vendor "Microsoft") (
      osgen "2003")
     (accuracy "100")))))
 (uptime ((lastboot "") (seconds "")))
 (tcpsequence ((index "261") (values "4F9A463D,FDE9E1EF,6BE921A2,184CD5F3,20173F87,D8DD8272")
   (difficulty "Good luck!")))
 (ipidsequence ((values "3AD0,3ADF,3AE8,3AE9,3AEA,3AEB") (class "Busy server or unknown class")))
 (tcptssequence ((values "0,0,0,0,0,0") (class "zero timestamp")))
 (trace ((port "80") (proto "tcp")) (hop ((rtt "3.98") (host "") (ipaddr "211.11.211.217")
    (ttl "1")))
  (hop ((rtt "2.72") (host "") (ipaddr "211.11.11.50") (ttl "2")))
  (hop ((rtt "1.56") (host "") (ipaddr "211.11.11.49") (ttl "3")))
  (hop ((rtt "11.64") (host "") (ipaddr "211.11.7.74") (ttl "6")))
  (hop ((rtt "11.46") (host "") (ipaddr "211.111.5.74") (ttl "7")))
  (hop ((rtt "11.30") (host "") (ipaddr "211.11.11.145") (ttl "8")))
  (hop ((rtt "11.18") (host "") (ipaddr "211.11.11.17") (ttl "9")))
  (hop ((rtt "11.94") (host "") (ipaddr "111.11.111.17") (ttl "10")))
  (hop ((rtt "11.48") (host "") (ipaddr "111.11.111.234") (ttl "11")))
  (hop ((rtt "11.19") (host "") (ipaddr "111.11.11.102") (ttl "12")))
  (hop ((rtt "11.75") (host "") (ipaddr "11.11.111.106") (ttl "13")))
 ))
 (host ((comment "")) (status ((state "up"))) (address ((addrtype "ipv4") (vendor
    "")
   (addr "111.11.11.4")))
 (hostnames)
 (ports (extraports ((count "999") (state "filtered"))) (port ((protocol "tcp") (
     portid "80"))
   (state ((reason "syn-ack") (state "open") (reason_ttl "114")))
   (service ((product "Apache httpd") (name "http") (extrainfo "(Win32)") (version
      "2.2.17")
     (conf "10")
     (method "probed")))))
 (os (portused ((state "open") (portid "80") (proto "tcp"))) (osmatch ((line "44168")
    (name "Microsoft Windows Server 2003 SP1 - SP2")
    (accuracy "100"))
   (osclass ((type "general purpose") (osfamily "Windows") (vendor "Microsoft") (
      osgen "2003")
     (accuracy "100"))))
  (osmatch ((line "50322") (name "Microsoft Windows XP SP2") (accuracy "100")) (osclass
    ((type "general purpose") (osfamily "Windows") (vendor "Microsoft") (osgen "XP")
     (accuracy "100"))))
  (osmatch ((line "50937") (name "Microsoft Windows XP SP2 or Windows Server 2003 SP2")
    (accuracy "100"))
   (osclass ((type "general purpose") (osfamily "Windows") (vendor "Microsoft") (
      osgen "2003")
     (accuracy "100")))))
 (uptime ((lastboot "") (seconds "")))
 (tcpsequence ((index "261") (values "4F9A463D,FDE9E1EF,6BE921A2,184CD5F3,20173F87,D8DD8272")
   (difficulty "Good luck!")))
 (ipidsequence ((values "3AD0,3ADF,3AE8,3AE9,3AEA,3AEB") (class "Busy server or unknown class")))
 (tcptssequence ((values "0,0,0,0,0,0") (class "zero timestamp")))
 (trace ((port "80") (proto "tcp")) (hop ((rtt "3.98") (host "") (ipaddr "211.11.211.217")
    (ttl "1")))
  (hop ((rtt "2.72") (host "") (ipaddr "211.11.11.50") (ttl "2")))
  (hop ((rtt "1.56") (host "") (ipaddr "211.11.11.49") (ttl "3")))
  (hop ((rtt "11.64") (host "") (ipaddr "211.11.7.74") (ttl "6")))
  (hop ((rtt "11.46") (host "") (ipaddr "211.111.5.74") (ttl "7")))
  (hop ((rtt "11.30") (host "") (ipaddr "211.11.11.145") (ttl "8")))
  (hop ((rtt "11.18") (host "") (ipaddr "211.11.11.17") (ttl "9")))
  (hop ((rtt "11.94") (host "") (ipaddr "111.11.111.17") (ttl "10")))
  (hop ((rtt "11.48") (host "") (ipaddr "111.11.111.234") (ttl "11")))
  (hop ((rtt "11.19") (host "") (ipaddr "111.11.11.102") (ttl "12")))
  (hop ((rtt "11.75") (host "") (ipaddr "11.11.111.106") (ttl "13")))
 ))
 ))
(define (get-value form_lst xml_lst)
   (let (result (ref form_lst xml_lst match true))
      (if result (last result) "")))
(define (pick-ip-port-from-service xml)
    (let    (allindex (ref-all '(name "http") xml))
            (dolist (idx allindex)
            (println "___1___" )
            (set 'txml (xml (0 -5 idx )))
            (println "___2___" )
            (if (or (ref  "open"  txml) (println "***********"));broken when dislay 2 times
             (println (ref  '(portid *)  txml match true))
             ))
    )
)
(pick-ip-port-from-service xo)
#8
newLISP in the real world / confused by replace ?
September 10, 2012, 07:02:24 AM

> (setf str {abc1111abc222})
"abc1111abc222"
> (replace {a(bc)} str (push  $1 lst -1) 0)
"abc1111abc222"
;why ?
;(push  $1 lst -1)  will return lst then  lst replace {a(bc)}    ???
;
> (setf lst nil)
nil
> (replace {a(bc)} str (println (push  $1 lst -1)) 0)
("bc")
("bc" "bc")
"abc1111abc222"

> (replace {a(bc)} str $1  0)
"bc1111bc222"

#9
Now it's not work even a simple login test.


(print (POP3:get-mail-status ""user" "password" "my-isp.com"))

==!
#10
A very light compact editor.



Now Supoort newLISP's Syntax highlighting, code folding, code indentation.



At present, only the windows version will soon launch the MAC and LINUX version.



EverEdit will be a combination of Editplus and TextMate.



Configuration is simple, powerful, clear interface. UTF-8 support and wide characters.



Will support the api the prompt, snippt, and taglist near future.



More than just words, must cool after use.



Site:

http://www.everedit.net/">http://www.everedit.net/



Forum:

http://forum.everedit.net">http://forum.everedit.net



官方QQ群:

8085515





http://files.myopera.com/freewinger/blog/EverEdit1.png">

http://files.myopera.com/freewinger/blog/EverEdit2.png">

http://files.myopera.com/freewinger/blog/EverEdit3.png">

http://files.myopera.com/freewinger/blog/EverEdit4.png">

http://files.myopera.com/freewinger/blog/EverEdit5.png">



more pic can see:

http://my.opera.com/freewinger/blog/2012/06/20/everedit-big-bang-from-everedit">http://my.opera.com/freewinger/blog/201 ... m-everedit">http://my.opera.com/freewinger/blog/2012/06/20/everedit-big-bang-from-everedit



EverEdit is a fast, lightweight, extendable text and source editor for Windows(Windows XP, Windows Vista, Windows 7, Windows Server 2003+). While it can serve as a good Notepad replacement, it also offers many powerful features for Web page authors and programmers.



•Full Unicode support(U16, U16-BE, UTF-8, Chinese, Japanese, Korean...)

•Super encoding detector

•Edit huge files with a little memory

•Regular expression(DEELX)

•Embedded VBS script engine

•Macro & Plugin support

•User customize tools support

•Click-able status bar

•Drag&Drop support

•Programmable highlight files

•Print & Print-preview support

•Word auto complete

•Customizable keyboard

•Column mode(Column insert, delete, copy and paste), press alt when moving mouse

•No limited undo, redo support

•Theme-able edit area

•Code folding

•Input-able, Command-able output window

•Grep with highlight

•Display Invisible Chars(EOL, EOF, Control Chars...)

•Brace Match

•HEX Editor

•Multiple Language Support(English, Chinese)
#11
Today I write a Script to download newlisp's benchmark code.

But I Can't find file in my directory.

I was scared! It been eat ! OMG

(set 'page (get-url "http://www.newlisp.org/benchmarks/"))
(set 'files (find-all {(syntax.cgi?benchmarks/.*newlisp.txt)"} page $1)) ;ye , this is error filename, so suk!
(println files)
(dolist (file files)
  (write-file (string "./"file)
  (get-url (string "http://www.newlisp.org/" file)))
  (println "->" file))

(exit)
#12
I want to see the parsing part  

just like:

http://code.google.com/p/asm-programming-language/source/browse/src/dasm/parser.d">http://code.google.com/p/asm-programmin ... m/parser.d">http://code.google.com/p/asm-programming-language/source/browse/src/dasm/parser.d
#13
manual
;;;;
(map (curry :area) (list (myrect mycircle))) → (200 314.1592654)


;;;;
(set 'A (array 2 3 (sequence 1 6))) → ((1 2) (3 4) (5 6))




;;;;reader-event
(context 'macro)

; registers a macro
(define-macro (macro:macro callp body)
    (push (list (first callp) '*) macro-list -1)
    (eval (expand '(define-macro callp (expand 'body)) 'callp 'body))
)

;must add otherwise will throw error when eval write express
(setf macro-list '())
;



guiserver

(gs:set-grid-layout sym-container int-columns int-rows [int-hgap int-vgap])
change to
(gs:set-grid-layout sym-container int-rows int-columns [int-hgap int-vgap])


parameter: str-down-con-path - The path for a pressed down image icon.
to
parameter: str-down-icon-path - The path for a pressed down image icon.

gs:draw-image
lost parameter:str-path



code pattern

(setf '("Anne" address city) persons '(city "Boston")) → (city "New York")
to
(setf (assoc '("Anne" address city) persons) '(city "Boston")) → (city "New York")


Many other schemes to configure a net-eval parameter list are possible. The following scheme without idle-loop would give the same results:
example code no changes


foo is the address to the structure astruc
to
foo3 is the address to the structure astruc


???
formats "u" and "d" may produce different results, because of sign expansion from 16 to 32 bits

> (setf zs "哈哈")
"哈哈"
> (pop zs -1)

ERR: not enough memory in function pop

can't pop utf-8string by index with -1


#14
newLISP in the real world / Scite4NewLisp
March 28, 2012, 11:47:25 PM
Scite4NewLisp



keyword autocomplete and calltip brace and double quotes autocomplete



havc fun guy :)



http://code.google.com/p/scite-for-newlisp/downloads/list">http://code.google.com/p/scite-for-newl ... loads/list">http://code.google.com/p/scite-for-newlisp/downloads/list
#15
Spent more than two weeks to complete the work

Everything is worth it

Hope that more people able to reach this happy language



http://code.google.com/p/newlisp-code-pattern-cn/downloads">//http://code.google.com/p/newlisp-code-pattern-cn/downloads

If you have any questions give me a message

http://my.opera.com/freewinger/blog/">//http://my.opera.com/freewinger/blog/

free.winger at gmail.com



NewLisp --- 大道至简