示例#1
0
void CFtpFileDlg::OnBnClickedCancel2()
{
	UpdateData(TRUE);
	m_BtnQuery.EnableWindow(FALSE);
	m_EditFtp.EnableWindow(FALSE);
	m_EditName.EnableWindow(FALSE);
	m_EditPwd.EnableWindow(FALSE);
	CString strSourceName,strDesName;
	CFileDialog fdlg(TRUE);
	if (fdlg.DoModal()==IDOK){
		strSourceName = fdlg.GetPathName();
		strDesName = fdlg.GetFileName();
		if (PutFile(strSourceName,strDesName)){
			AfxMessageBox("上传成功!",MB_OK|MB_ICONINFORMATION);
		}
		else{
			AfxMessageBox("上传失败!",MB_OK|MB_ICONSTOP);
		}
	}
	else{
		AfxMessageBox("请选择文件!",MB_OK|MB_ICONSTOP);
	}
	m_BtnUpLoad.EnableWindow(TRUE);
	m_BtnQuery.EnableWindow(TRUE);
	m_EditFtp.EnableWindow(TRUE);
	m_EditName.EnableWindow(TRUE);
	m_EditPwd.EnableWindow(TRUE);
}
示例#2
0
/* Makes a stack profile on file stackFile. */
void MakeStackProfile(void) {
  int i, no, sampleNo;
  TickList *newTick;
  int *sampleNoTab;
  float sampleTime;
  
  char idStr[100];

  GraphReset();

  if ((outfp = fopen((char *) &stackName, "w")) == NULL) {
    printf("Can not open stackfile: %s.\n", stackName);
    exit(-1);
  }

  sprintf(idStr, "%s - Stack profiling", name);
  jobstring = MallocString(idStr);
  sprintf(idStr, "%s", timeStr);
  datestring = MallocString(idStr);

  sampleNoTab = xmalloc(noOfSamples * sizeof(int));

  no = sortSamples(sortOpt, sampleNoTab);
  i = 0;
  sampleNo = 0;
  for (newTick=firstTick;newTick!=NULL;newTick=newTick->nTick,i++) {
    if ((sampleNo < no) && (sampleNoTab[sampleNo] == i)) {
      if (useTickNo) {
	sampleTime = (float)i;
      }
      else {
	sampleTime = (float)newTick->time/(float)CLOCKS_PER_SEC;
      }
      /*printf("sampleNo %3d SampleTime %5.2f\n", sampleNo, sampleTime);*/
      allocNewSample(sampleNo, sampleTime);
      storeSampleEntry(sampleNo, sampleTime, "stack", ((float)(newTick->stackUse))*4.0);
      storeSampleEntry(sampleNo, sampleTime, "rDesc", ((float)(newTick->regionDescUse))*4.0);

      sampleNo++;
    }
  }

  if (sampleNo != nsamples)           /* These two variables have to follow each other. */
    Disaster("sampleNo <> nsamples");
    
  if ((noOfSamples >= SampleMax) && (SampleMax != nsamples))         /* If we have more than SampleMax samples, */
    Disaster("noOfSamples >= SampleMax and SampleMax <> nsamples."); /* then we keep exactly SampleMax samples. */

  showMax = 0; /* Do not show a maximum line. */
  yLab = MallocString("bytes");
  PutFile();
  return;
}
示例#3
0
static BOOL ExecuteFTPCommand(FTP_COMMAND cmd)
{
    switch(cmd)
    {
    case FTP_CMD_USER:
        FTPFlags.Bits.bUserSupplied = TRUE;
        FTPFlags.Bits.bLoggedIn = FALSE;
        FTPResponse = FTP_RESP_USER_OK;
        strncpy(FTPUser, FTP_argv[1], sizeof(FTPUser));
        break;

    case FTP_CMD_PASS:
        if ( !FTPFlags.Bits.bUserSupplied )
            FTPResponse = FTP_RESP_LOGIN;
        else
        {
            if ( FTPVerify(FTPUser, FTP_argv[1]) )
            {
                FTPFlags.Bits.bLoggedIn = TRUE;
                FTPResponse = FTP_RESP_PASS_OK;
            }
            else
                FTPResponse = FTP_RESP_LOGIN;
        }
        break;

    case FTP_CMD_QUIT:
        return Quit();

    case FTP_CMD_PORT:
        FTPDataPort.v[1] = (BYTE)atoi(FTP_argv[5]);
        FTPDataPort.v[0] = (BYTE)atoi(FTP_argv[6]);
        FTPResponse = FTP_RESP_OK;
        break;

    case FTP_CMD_STOR:
        return PutFile();

    case FTP_CMD_ABORT:
        FTPResponse = FTP_RESP_OK;
        if ( FTPDataSocket != INVALID_SOCKET )
            TCPDisconnect(FTPDataSocket);
        break;

    default:
        FTPResponse = FTP_RESP_UNKNOWN;
        break;
    }
    return TRUE;
}
示例#4
0
int processCmd(SOCKET sock, PCMD cmd) {
	int res;
	switch (cmd->name) {
		case 'l':
			res = RemoteFilesList(sock); break;
		case 'u':
			res = PutFile(sock, cmd->fileName); break;
		case 'd':
			res = GetFile(sock, cmd->fileName); break;
		default:
			res= INTERNAL_ERROR;
	}
	return res;
}
示例#5
0
/**
 * @ingroup SipSpeed
 * @brief 멤버변수를 설정 파일로 저장한다.
 * @return 성공하면 true 를 리턴하고 실패하면 false 를 리턴한다.
 */
bool CSetup::Put()
{
	PutString( ST_SIP_SERVER_IP, m_strSipServerIp.c_str() );
	PutInt( ST_SIP_SERVER_PORT, m_iSipServerPort );
	PutString( ST_SIP_DOMAIN, m_strSipDomain.c_str() );
	PutString( ST_CALLER_ID, m_strCallerId.c_str() );
	PutString( ST_CALLER_PW, m_strCallerPassWord.c_str() );
	PutString( ST_CALLEE_ID, m_strCalleeId.c_str() );
	PutString( ST_CALLEE_PW, m_strCalleePassWord.c_str() );
	PutInt( ST_CALL_TOTAL_COUNT, m_iCallTotalCount );
	PutInt( ST_CALL_CONCURRENT_COUNT, m_iCallConcurrentCount );
	PutInt( ST_TEST_TYPE, m_iTestType );

	bool bRes = PutFile();

	m_clsMap.clear();

	return bRes;
}
示例#6
0
文件: Transfer.cpp 项目: TMDJoJo/PP
void Transfer::OnListFinish(bool error){
    if(error){
        ReSet();
        return ;
    }

    switch(list_step_){
    case IN_ROOT:{
        if(have_host_){
            ftp_.cd(HOST_NAME);
        }
        else{
            ftp_.mkdir(HOST_NAME);
        }
    }break;
    case IN_HOST:{
        if(have_user_dir_){
            ftp_.cd(g_configuer->user_name_);
        }
        else{
            ftp_.mkdir(g_configuer->user_name_);
        }
    }break;
    case IN_USER_NAME:{
        if(have_no_file_){
            PutFile();
        }
        else{
            have_no_file_ = true;
            ftp_.list();
        }

    }break;
    default:
        break;
    }
}
示例#7
0
bool ObjIeeeAscii::Comment(const char *buffer, eParseType ParseType)
{
    if (!file)
        ThrowSyntax(buffer, ParseType);
    int pos = 2;
    int cnum = ObjUtil::FromDecimal(buffer, &pos,3);
    if (buffer[pos++] != ',')
        ThrowSyntax(buffer, ParseType);
    ObjString contents = ParseString(buffer, &pos);
    const char *data = contents.c_str();
    CheckTerm(buffer + pos);
    switch (cnum)
    {
        case eAbsolute:
            absolute = true; // absolute file
            break;
        case eMakePass:
            if (ParseType == eMake)
                return true;
            break;
        case eLinkPass:
            if (ParseType == eLink)
                return true;
            break;
        case eBrowsePass:
            if (ParseType == eBrowse)
                return true;
            break;
        case eConfig: /* not supported */
            break;
        case eDefinition:
        {
            int pos = 0;
            ObjString name = ParseString(data, &pos);
            if (data[pos++] != ',')
                ThrowSyntax(buffer, ParseType);
            ObjInt value = ObjUtil::FromDecimal(data, &pos);
            ObjDefinitionSymbol *sym = factory->MakeDefinitionSymbol(name);	
            sym->SetValue(value);
            file->Add(sym);
            break;
        }
        case eExport:
        {
            bool byOrdinal;
            if (data[0] == 'O')
                byOrdinal = true;
            else if (data[0] == 'N')
                byOrdinal = false;
            else 
                ThrowSyntax(buffer, ParseType);
            if (data[1] != ',')
                ThrowSyntax(buffer, ParseType);
            int pos = 2;
            ObjString name = ParseString(data, &pos);
            if (data[pos++] != ',')
                ThrowSyntax(buffer, ParseType);
            ObjString externalName;
            int ordinal = 0xffffffff;
            if (byOrdinal)
                ordinal = ObjUtil::FromDecimal(data, &pos);
            else
                externalName = ParseString(data, &pos);
            ObjString moduleName;
            if (data[pos] == ',')
            {
                pos++;
                moduleName = ParseString(data, &pos);
            }
            if (!GetCaseSensitiveFlag())
            {
                for (int i=0; i < name.size(); i++)
                    name[i] = toupper(name[i]);
            }
            ObjExportSymbol *sym = factory->MakeExportSymbol(name);	
            sym->SetByOrdinal(byOrdinal);
            sym->SetOrdinal(ordinal);
            sym->SetExternalName(externalName);
            sym->SetDllName(moduleName);
            file->Add(sym);
            break;
        }
        case eImport:
        {
            bool byOrdinal;
            if (data[0] == 'O')
                byOrdinal = true;
            else if (data[0] == 'N')
                byOrdinal = false;
            else 
                ThrowSyntax(buffer, ParseType);
            if (data[1] != ',')
                ThrowSyntax(buffer, ParseType);
            int pos = 2;
            ObjString name = ParseString(data, &pos);
            if (data[pos++] != ',')
                ThrowSyntax(buffer, ParseType);
            ObjString externalName;
            int ordinal = 0xffffffff;
            ObjString dllName;
            if (byOrdinal)
                ordinal = ObjUtil::FromDecimal(data, &pos);
            else
                externalName = ParseString(data, &pos);
            if (data[pos++] != ',')
                ThrowSyntax(buffer, ParseType);
            dllName = ParseString(data, &pos);
            if (!GetCaseSensitiveFlag())
            {
                for (int i=0; i < name.size(); i++)
                    name[i] = toupper(name[i]);
            }
            ObjImportSymbol *sym = factory->MakeImportSymbol(name);	
            sym->SetByOrdinal(byOrdinal);
            sym->SetOrdinal(ordinal);
            sym->SetExternalName(externalName);
            sym->SetDllName(dllName);
            file->Add(sym);
            break;
        }
        case eSourceFile:
        {
            int pos = 0;
            int index = ObjUtil::FromDecimal(data, &pos);
            if (data[pos++] != ',')
                ThrowSyntax(buffer, ParseType);
            ObjString name = ParseString(data, &pos);
            if (data[pos++] != ',')
                ThrowSyntax(buffer, ParseType);
            std::tm time;
            ParseTime(data, time, &pos);
            ObjSourceFile *sf = factory->MakeSourceFile(name, index);
            sf->SetFileTime(time);
            PutFile(index, sf);
            break;
        }
        case eBrowseInfo:
        {
            ObjBrowseInfo::eType type;
            ObjBrowseInfo::eQual qual;
            int pos = 0;
            type = (ObjBrowseInfo::eType)ObjUtil::FromHex(data, &pos);
            if (data[pos++] != ',')
                ThrowSyntax(buffer, ParseType);
            qual = (ObjBrowseInfo::eQual)ObjUtil::FromHex(data, &pos);
            if (data[pos++] != ',')
                ThrowSyntax(buffer, ParseType);
            int filenum = ObjUtil::FromDecimal(data, &pos);
            if (data[pos++] != ',')
                ThrowSyntax(buffer, ParseType);
            int lineno = ObjUtil::FromDecimal(data, &pos);
            if (data[pos++] != ',')
                ThrowSyntax(buffer, ParseType);
            int charpos = ObjUtil::FromDecimal(data, &pos);
            if (data[pos++] != ',')
                ThrowSyntax(buffer, ParseType);
            ObjString extra = ParseString(data, &pos);
            ObjSourceFile *sf = files[filenum];
            if (!sf)
                ThrowSyntax(buffer, ParseType);
            ObjLineNo *line = factory->MakeLineNo(sf, lineno);
            ObjBrowseInfo *bi = factory->MakeBrowseInfo(type, qual, line, charpos, extra);	
            file->Add(bi);
            break;
        }
        case eLineNo:
        {
            int pos = 0;
            int index = ObjUtil::FromDecimal(data, &pos);
            if (data[pos++] != ',')
                ThrowSyntax(buffer, ParseType);
            int line = ObjUtil::FromDecimal(data, &pos);
            ObjSourceFile *file = files[index];
            if (!file)
                ThrowSyntax(buffer, ParseType);
            ObjLineNo *lineNo= factory->MakeLineNo(file, line);
            ObjDebugTag *tag = factory->MakeDebugTag(lineNo);
            currentTags->push_back(tag);
            break;
        }	
        case eVar:
        {
            int pos = 0;
            int ch = data[pos++];
            int index = ObjUtil::FromHex(data, &pos);
            ObjSymbol *sym = FindSymbol(ch, index);
            if (!sym)
                ThrowSyntax(buffer, ParseType);
            ObjDebugTag *tag = factory->MakeDebugTag(sym);
            currentTags->push_back(tag);
            break;
        }
        case eBlockStart:
        {
            ObjDebugTag *tag = factory->MakeDebugTag(true);
            currentTags->push_back(tag);
            break;
        }
        case eBlockEnd:
        {
            ObjDebugTag *tag = factory->MakeDebugTag(false);
            currentTags->push_back(tag);
            break;
        }
        case eFunctionStart:
        case eFunctionEnd:
            int pos = 0;
            int ch = data[pos++];
            int index = ObjUtil::FromHex(data, &pos);
            ObjSymbol *sym = FindSymbol(ch, index);
            if (!sym)
                ThrowSyntax(buffer, ParseType);
            ObjDebugTag *tag = factory->MakeDebugTag(sym, cnum == eFunctionStart);
            currentTags->push_back(tag);
            break;
    }
    return false;
}
示例#8
0
void dbFTPPutFile ( char* szString )
{
	PutFile ( ( DWORD ) szString );
}
示例#9
0
//--------------------------------------------------------------------------------
//  主函数
//--------------------------------------------------------------------------------
void main(int argc, char **argv)
{
   char *url = NULL;
   int   i   = 0;
   
   printf("WinRAR 3.x LHA Buffer Overflow Exploit (F*****g 0day!!!)\n");
   printf("Code by nop nop#xsec.org, Welcome to http://www.xsec.org\n\n");  
   
   InitRandom();
   
   if(argc < 2)
   {
       usage(argv[0]);
       return;
   }
   
   for(i=1; i<argc-1; i++)
   {
       switch(argv[i][1])
       {
       case 'a':
           if(i < argc-1 && TestIfIsValue(argv[i+1]))
           {    
               AppFile = argv[i+1];
               bAppend = TRUE;
           }
           else
           {
               usage(argv[0]);
               return;
           }
           i++;
           break;
       case 'o':
          if(i < argc-1 && TestIfIsValue(argv[i+1]))
           {    
               OutFile = argv[i+1];
           }
           else
           {
               usage(argv[0]);
               return;
           }
           i++;
           break;
       case 't':
           if(i < argc-1 && TestIfIsValue(argv[i+1]))
           {    
               iType = atoi(argv[i+1]);
           }
           else
           {
               usage(argv[0]);
               return;
           }
           i++;
           break;
       }
   }
   
   ExeFile = argv[i];

   if((iType<0) || (iType>=sizeof(targets)/sizeof(v)))
   {
       usage(argv[0]);
       printf("[-] Invalid type.\n");
       return;
   }
   
   PutFile(OutFile);
}
示例#10
0
/* Makes a region profile. */
void MakeObjectProfile(int region) {
  int i, sampleNo, no;
  TickList *newTick;
  ObjectList *newObj;
  RegionList *newRegion;
  int *sampleNoTab;
  float sampleTime;
  
  char idStr[100];
  int success = 0;

  GraphReset();

  if ((outfp = fopen((char *) &objName, "w")) == NULL) {
    printf("Cannot open output file %s.\n", objName);
    exit(-1);
  }

  sprintf(idStr, "%s - Object profiling on region %d", name, region);
  jobstring = MallocString(idStr);
  sprintf(idStr, "%s", timeStr);
  datestring = MallocString(idStr);

  sampleNoTab = xmalloc(noOfSamples * sizeof(int));

  no = sortSamples(sortOpt, sampleNoTab);
  i = 0;
  sampleNo = 0;
  for (newTick=firstTick;newTick!=NULL;newTick=newTick->nTick,i++) {
    if ((sampleNo < no) && (sampleNoTab[sampleNo] == i)) {
      if (useTickNo) {
	sampleTime = (float)i;
      }
      else {
	sampleTime = (float)newTick->time/(float)CLOCKS_PER_SEC;
      }
      /*printf("sampleNo %3d SampleTime %5.2f\n", sampleNo, sampleTime);*/
      allocNewSample(sampleNo, sampleTime);
	  
      for (newRegion=newTick->fRegion;newRegion!=NULL;newRegion=newRegion->nRegion) {
	if (newRegion->regionId == region) 
	  for (newObj=newRegion->fObj;newObj!=NULL;newObj=newObj->nObj) {
	    success = 1;
	    sprintf(idStr, "pp%d", newObj->atId);
	    storeSampleEntry(sampleNo, sampleTime, idStr, ((float)(newObj->size))*4.0);
	  }
      }
      sampleNo++;
    }
  }

  if (success == 0) {
    printf("There is no profiling information for region r%d, so I could not \ncreate a PostScript file for you.\n",
	   region);
    exit(-1);
  }

  if (sampleNo != nsamples)           /* These two variables have to follow each other. */
    Disaster("sampleNo <> nsamples");
    
  if ((noOfSamples >= SampleMax) && (SampleMax != nsamples))         /* If we have more than SampleMax samples, */
    Disaster("noOfSamples >= SampleMax and SampleMax <> nsamples."); /* then we keep exactly SampleMax samples. */

  showMax = 1;
  maxValue = profTabGetMaxAlloc(region)*4;
  sprintf(maxValueStr, "Maximum allocated bytes in this region: %2.0f.", maxValue);
  yLab = MallocString("bytes");
  PutFile();
  return;
}
示例#11
0
/* Makes a region profile. */
void MakeRegionProfile(void) {
  int i, sampleNo, no;
  TickList *newTick;
  RegionList *newRegion;
  int *sampleNoTab;
  float sampleTime;
  float maxStack = 0.0;
  
  char idStr[100];

  GraphReset();

  if ((outfp = fopen((char *) &rpName, "w")) == NULL) {
    printf("Can not open output file %s.\n", rpName);
    exit(-1);
  }

  sprintf(idStr, "%s - Region profiling", name);
  jobstring = MallocString(idStr);
  sprintf(idStr, "%s", timeStr);
  datestring = MallocString(idStr);

  sampleNoTab = xmalloc(noOfSamples * sizeof(int));

  no = sortSamples(sortOpt, sampleNoTab);
  i = 0;
  sampleNo = 0;
  for (newTick=firstTick;newTick!=NULL;newTick=newTick->nTick,i++) {
    if ((sampleNo < no) && (sampleNoTab[sampleNo] == i)) {
      if (useTickNo) {
	sampleTime = (float)i;
      }
      else {
	sampleTime = (float)newTick->time/(float)CLOCKS_PER_SEC;
      }
      /*printf("sampleNo %3d SampleTime %5.2f\n", sampleNo, sampleTime);*/
      allocNewSample(sampleNo, sampleTime);
      storeSampleEntry(sampleNo, sampleTime, "stack", ((float)(newTick->stackUse))*4.0);
      storeSampleEntry(sampleNo, sampleTime, "rDesc", ((float)(newTick->regionDescUse))*4.0);

      if (((((float)(newTick->stackUse))+((float)(newTick->regionDescUse)))*4.0) > maxStack) /* To ajust the max. */
	maxStack = (((float)(newTick->stackUse))+((float)(newTick->regionDescUse)))*4.0;     /* allocation line.  */
	  
      for (newRegion=newTick->fRegion;newRegion!=NULL;newRegion=newRegion->nRegion) {
	if (newRegion->infinite) 
	  sprintf(idStr, "r%dinf", newRegion->regionId);
	else 
	  sprintf(idStr, "r%dfin", newRegion->regionId);

	storeSampleEntry(sampleNo, sampleTime, idStr, ((float)(newRegion->used))*4.0);
      }
      sampleNo++;
    }
  }

  if (sampleNo != nsamples)           /* These two variables have to follow each other. */
    Disaster("sampleNo <> nsamples");
    
  if ((noOfSamples >= SampleMax) && (SampleMax != nsamples))         /* If we have more than SampleMax samples, */
    Disaster("noOfSamples >= SampleMax and SampleMax <> nsamples."); /* then we keep exactly SampleMax samples. */

  showMax = 1;
  maxValue = maxRegions*4;   /* The total memory used is often lower than what the line suggests
			      * because the time the stack is maximal may not be the same time
			      * that allocation in regions is maximal! mael 2001-05-22 */
  sprintf(maxValueStr, "Maximum allocated bytes in regions (%2.0f) and on stack (%2.0f)", maxValue, maxStack);
  maxValue += maxStack; /* Ajusting the max. allocation line. */
  yLab = MallocString("bytes");
  PutFile();
  return;
}