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?
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
;#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)
function?loadQuote
function no effect.silentQuote
Quote
> (setf xo2 (get-url "http://www.baidu.com/link?url=kX6MGJqjJ4zBBpC8yDF8xDhzsTii46BoCipLx6xJ2t3626ZBIWUltBgpQyK"> " "list debug" 10000 ))http://www.baidu.com/link?url=kX6MGJqjJ ... WUltBgpQyK">http://www.baidu.com/link?url=kX6MGJqjJ4zBBpC8yDF8xDhzsTii46BoCipLx6xJ2t3626ZBIWUltBgpQyK
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 .
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">........
(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)
.
.
.
(set 'socket (net-connect "www.baidu.com" 80))
(net-send socket "GET /rnrn")
(net-receive socket buffer 10000);have issuses
(println buffer)
(exit)
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
(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)
> (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"
(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)
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