Advertisement
Guest User

Untitled

a guest
Jun 16th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. #include<cstdio>
  2. #include<cstring>
  3. #include<cstdlib>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. char str[10000],temp[100];
  9. char store[100][1000];
  10. bool found=false;
  11. FILE * pFile;
  12. pFile = fopen ("out","w");
  13.  
  14. system("lsusb >> out");
  15. fclose(pFile);
  16.  
  17. pFile = fopen ("out","r");
  18.  
  19. while(fgets(str,100,pFile))
  20. {
  21.  
  22.  
  23. sscanf(str,"%s%s%s%s%s%s%s",temp,temp,temp,temp,temp,temp,temp);
  24.  
  25. if(strcmp(temp,"ONDA")==0)
  26. {
  27. printf("%s",str);
  28. found=true;
  29. break;
  30. }
  31.  
  32.  
  33. }
  34. fclose(pFile);
  35. if(found)
  36. {
  37.  
  38. int len,c=0,i;
  39. char id[2],ch;
  40. char mod_probe_str[100]="sudo modprobe usbserial vendor=0×19d2 product=0×fff";
  41.  
  42. sscanf(str,"%s%s%s%s%s%s",temp,temp,temp,temp,temp,temp);
  43. len=strlen(temp);
  44. ch=temp[len-1];
  45. sprintf(id,"%c",ch);
  46. printf("ID = %s\n",id);
  47. strcat(mod_probe_str,id);
  48. puts(mod_probe_str);
  49. system(mod_probe_str);
  50.  
  51. pFile = fopen ("/etc/wvdial.conf","r");
  52. if(pFile==NULL) puts("NOT FOUND");
  53. else
  54. while(fgets(store[c++],100,pFile)){}
  55.  
  56. fclose(pFile);
  57. strcpy(store[c++],"[Dialer citycell]\n");
  58. strcpy(store[c++],"Username = waps\n");
  59. strcpy(store[c++],"Password = waps\n");
  60. strcpy(store[c++],"Phone = #777\n");
  61. strcpy(store[c++],"Stupid Mode = 1\n");
  62.  
  63. for(i=0;i<c;i++)
  64. printf("%s",store[i]);
  65.  
  66.  
  67.  
  68. }
  69.  
  70.  
  71. return 0;
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement