Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<cstdio>
- #include<cstring>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- char str[10000],temp[100];
- char store[100][1000];
- bool found=false;
- FILE * pFile;
- pFile = fopen ("out","w");
- system("lsusb >> out");
- fclose(pFile);
- pFile = fopen ("out","r");
- while(fgets(str,100,pFile))
- {
- sscanf(str,"%s%s%s%s%s%s%s",temp,temp,temp,temp,temp,temp,temp);
- if(strcmp(temp,"ONDA")==0)
- {
- printf("%s",str);
- found=true;
- break;
- }
- }
- fclose(pFile);
- if(found)
- {
- int len,c=0,i;
- char id[2],ch;
- char mod_probe_str[100]="sudo modprobe usbserial vendor=0×19d2 product=0×fff";
- sscanf(str,"%s%s%s%s%s%s",temp,temp,temp,temp,temp,temp);
- len=strlen(temp);
- ch=temp[len-1];
- sprintf(id,"%c",ch);
- printf("ID = %s\n",id);
- strcat(mod_probe_str,id);
- puts(mod_probe_str);
- system(mod_probe_str);
- pFile = fopen ("/etc/wvdial.conf","r");
- if(pFile==NULL) puts("NOT FOUND");
- else
- while(fgets(store[c++],100,pFile)){}
- fclose(pFile);
- strcpy(store[c++],"[Dialer citycell]\n");
- strcpy(store[c++],"Username = waps\n");
- strcpy(store[c++],"Password = waps\n");
- strcpy(store[c++],"Phone = #777\n");
- strcpy(store[c++],"Stupid Mode = 1\n");
- for(i=0;i<c;i++)
- printf("%s",store[i]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement