Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

SgtBot

Member
  • Content Count

    77
  • Joined

  • Last visited

Awards


This user doesn't have any awards

About SgtBot

  • Title
    Member

Profile Information

  • Gender
    Male
  • Location
    Arizona
  • Interests
    1337 h4ck1ng
  • Biography
    I'm starting my Freshman year as a Cyber Intelligence and Security at Embry Riddle Aeronautical University. (You probably know more than I do about most computer things)
  • Occupation
    Lazy Student

System

  • CPU
    Pentium E2200
  • Motherboard
    ASUS LGA 1151 PRIME Z270-P Intel ATX Motherboard
  • RAM
    500MB DDR2
  • GPU
    2x GTX1080 TI SLI
  • Case
    ibuypower can'tyoutellimlyingaboutmyspecs
  • Storage
    300mb hdd
  • Display(s)
    something potatoish
  • Cooling
    just dumped some 50/50 antifreeze in there should be good
  • Keyboard
    old dell white clacky one
  • Mouse
    a razor or something
  • Sound
    something terrible
  • Operating System
    LINUX 4 L33T H4X0RS DUH

Recent Profile Visitors

647 profile views
  1. Hi, I have a pi hole working as the DNS server for my network, forcing all traffic to use it as the main DNS server. But I also want to set up an openvpn client profile on my router. I already have an openvpn server set up on one of my vps's. If I do this will the traffic coming through my network still have ads blocked? Or will I need to configure my vps with the vpn on it to use a custom DNS server? Thanks! Edit: Router is a newer ASUS router
  2. Thanks, I'll look into that. I think I've got some pretty good baseline code for it. For the pushbullet one, I use that as well. I have my google nest hub send a pushbullet command to my phone, which uses Automagic on my phone to send a WOL packet to my pc. I used Automagic because Taskr didn't have native WOL support. Here's the code I have so far, I'll look into implementing that push2run into the code if I can: import os import time from wakeonlan import send_magic_packet phone = "1.1.1.1" #Phone IP address computer = "2.2.2.2" #Computer IP address while True: time.sleep(20) #Ping for computer and/or phone every 20 seconds phone_response = os.system("ping -c 1 " + phone) # Initial ping for phone if phone_response == 0: print("Owner phone detected on network, sending magic packet...") # Sends WOL packet if phone is detected send_magic_packet('aa:bb:cc:dd:ee:ff') else: pc_response = os.system("ping -c 1 " + computer) if pc_response != 0: # This block checks if waking up the computer was waked print("Owner computer still offline, resending magic packet...") # and continues to ping until successful send_magic_packet('aa:bb:cc:dd:ee:ff') else: print("Owner phone and computer online, standing by...") # If owner and computer are both online, don't send any packets pass else: print("Owner phone offline, retrying...") # If phone is offline, start script over pass
  3. Thanks! I made a basic python script to implement that. I assigned my phone's mac address a static IP through DHCP on my router so I could still have the phone utilize pi-hole. Then I have the script ping that IP until it gets a successful ping, upon which it will send a magic packet to wake up the computer. The only issue is that it will keep repeatedly sending magic packets while my phone is on the network, so I've just got to edit it to send once on a successful ping to phone. I'll probably end up setting a variable to count how many wake on lan packets have been sent, and then increment it on each one. Then to make sure it actually wakes up the computer, I'll have the script ping my computer's IP and if the computer is still off it will reset the WOL packet counter to zero and try again. Idk if thats the most effective but it seems like a good shot so far Here's what I've got so far if you're curious: import os import time from wakeonlan import send_magic_packet hostname = "1.1.1.1" #My phone while True: time.sleep(20) response = os.system("ping -c 1 " + hostname) if response == 0: print("Owner phone detected on network, sending magic packet...") send_magic_packet('aa:bb:cc:dd:ee:ff') #Sends WOL packet to computer else: print("Owner phone offline, retrying...") pass
  4. Thanks! I already have WOL enabled but i just use an app from my phone to send the packet. I just need to have it automate itself on certain conditions from a rpi
  5. Hi, I'm currently trying to set up some quality of life smart home applications with a raspberry pi 4 I recently got. Right now all it has on it is pi-hole to filter out all of the ads on my network. My goal is to be able to have the raspberry pi be able to send a wake on lan packet to my computer when I either tell my google home to turn on my computer and/or when it detects that my phone's mac address has reconnected to my home network. I would also like to be able to have the reverse happen, I want to send a command to my computer (running windows 10 home) to shut down on either of the above conditions (except obviously when my phone's mac address leaves the home network). Here are my basic quesions: What is the most effective way to send a wake on lan packet from a raspberry pi to another device on the same network? Is there a Python library that would allow me to send WOL packets? Would I have to enable remote registry on my windows machine or is it possible to write a custom windows application that listens for instructions from the pi and executes a batch file to shut down? I can probably figure out how to listen for ifttt requests on the raspi and have the pi execute a command or script in response... but any suggestions on how to do this efficiently would be greatly appreciated! Any other smart home ideas like this with the pi would be welcomed as well. I'm currently working on modifying the pi to act as a smart thermostat as well to work with an AWS server so I can control my apartments temperature from anywhere. Thanks!
  6. I'm trying to make a basic navigation bar for a website, and I am adding social media icons in the navigation bar as well. I have some basic styling done with it to get the social media icons to actually sit in the navigation bar, but I feel like the way I do it will break on different devices. Below is a screenshot of what the navbar looks like and the css code that is organizing it. Any advice or tips would be appreciated :) body { background-image: url("keto.jpg"); } .navbar { font-family: "Times New Roman", Times, serif; font-style: normal; font-size: 20px; } .navleft { list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: #333; } .navleft li { float: left; } .navleft a { display: block; color: pink; text-align: center; padding: 14px 16px; text-decoration: none; } .navleft a:hover { background-color: #FFC0CB; color: #333; font-style: oblique; } .navright { list-style-type: none; margin-top: -42px; padding: 0; overflow: hidden; background-color: #333; } .navright li { float: right; display: inline; } .navright a { padding: 5px 5px; } .navright img { width: 35px; height: 35px; }
  7. I switched to shutil.move for the command, so the new code looks like: for i in range(len(fileList)): if fileList[i].split('.')[1] == fileType: if i == 0: try: os.mkdir(fileType) except FileExistsError: print("File already exists, continuing...") pass shutil.move(fileList[i], fileType) count = count+1 else: break But when I try to run the program in my folder, it doesn't even recognize that there are any word documents. I tried to run it in an empty folder with that one word document and it worked... but it seems when in needs to sort through multiple files it has problems.
  8. Hi, I am working on a file sorter in python to sort different file types into their respective folders so I can go through them later. Here is my code so far: import os loop = 'y' while loop == 'y': count = 0 fileType = input("What type of file would you like to sort? ") fileList = [] for files in os.walk("."): for filename in files[2]: fileList.append(filename) for i in range(len(fileList)): if fileList[i].split('.')[1] == fileType: if i == 0: try: os.mkdir(fileType) except FileExistsError: print("File already exists, continuing...") pass os.system("move "+fileList[i]+" "+fileType) count = count+1 else: break if count != 0: print("Moved", count, "file(s) into folder:", fileType) else: print("No files matching that type.") loop = input("\nSort more files? (y/n): ") It works great, but the only problem that I have is that it seems to bug out whenever the file name itself has a space in it. For example, when I tried to make it move a .docx document with the title: AS121 - HW10 - REGULATORY GUIDANCE, CERTIFICATES AND DOCUMENTS-2.docx, it said it moved the file, but did nothing instead. Here is a screenshot of cmd while it's running: I'm not sure why it would be doing this... I checked the fileList and split lines in my code, and it seems to split that word document perfectly fine into the name and the docx. Here is a screenshot of that: I'm not sure why it could be doing this. Do I have to have some kind of error handling to tell the program what to do when there is a space in the file name? I feel like it shouldn't matter since I don't split the file by spaces I split it by a period. Any help would be greatly appreciated!
  9. That code definitely works well, so another question I ask is if I wanted to read the entire contents of a file and print them out, say in this case if it had numbers and letters. Would that be possible with this code or would I need to instead read the binary of the file and convert it after I read the file?
  10. That is actually pretty embarrassing for me... I guess programming at 4 am isn't always the best idea. Anyways, I fixed those issues in my code now, and my new problem is a singular error stating that I am using too many arguments to the fopen function as shown below:
  11. Hi, I am trying to write a program that will print out the contents of a file. I also wanted to try making the program take an argument in the command line. Here is my code: #include <stdio.h> int readFile(char *infile) { int num; FILE *fptr; fptr = open("/home/students/hansong5/crypter/%c", infile, "r"); if(fptr == NULL) { printf("Error opening file"); } fscanf(fptr, "%d", &num); fclose(fptr); return num; } int main (int argc, char *argv[]) { printf(readFile(argv[1])); return 0; } I am having a number of problems. The first being that this code does not compile without warnings or errors, as shown below: For some reason, when I try to read the file using fopen, I get the error: "too many arguments". I am trying to specify the path name by putting the %c at the end of the path and specifying that it should use the first argument in the command as the path name. Then, I get a warning about making a pointer from an integer when using printf. Should I define a variable outside of the printf statement with the function instead of passing the function inside of the printf statement? The second problem is that when I try to run the code with warnings I get a segmentation fault. I believe that is just because I am misusing the pointers in my code but I'm not sure how to go about fixing this. Any help would be greatly appreciated! Disclaimer: While in my filepath you can see "student" as one of the directories, this particular project is not a homework assignment. I program mostly on a redhat server that the university provides us. I am trying to learn about reading and writing files and writing C programs with arguments on my own time to work on a crypter. I always specify whether or not the code I am sharing is part of a homework assignment because helping with homework may go against some people's ethics. I have post history with homework assignments I've worked on as proof of this.
  12. I see it now, I was trying to write the user input to the pointer, when I should have been writing to the variable that the pointer was pointing to, right? I think I fixed the code, and I added another function to print out the word backwards, but I'm not sure if I'm correctly understanding how to use the pointer in this function either. Here's the code: #include<stdio.h> #include<stdlib.h> main() { int getString(char *characterArray); void reverse(int charCount, char *characterArray); int charCount = 0; char characterArray[100]; /* Max buffer size for the array is 100 */ int maxChar; printf("Maximum number of characters for this run? "); scanf("%d", &maxChar); printf("\n Enter no more than %d characters: ", maxChar); charCount = getString(characterArray)-1; printf("\n You entered %d characters.\n", charCount); reverse(charCount, characterArray); } int getString(char *characterArray) { int charCount = 0; scanf(" %s%n", characterArray, &charCount); return charCount; } void reverse(int charCount, char *characterArray) { int i; for(i = charCount - 1; i < 0; i--) printf("%s", &characterArray[i]); } This code is printing out: it seems to start on the right side but starts spamming out random letters from the string that shouldn't be printing out. I'm not sure why its doing this unless it is a 2 dimensional array with multiple string arrays in the array.
  13. Hi, I am writing a C program that will take a certain number of characters (a word), print them backwards, and then tell the user whether or not the word is a palindrome. I ran into trouble with the scanf() function when trying to scan user input to a char variable after previously scanning into an int variable. After a quick Google search, I found out the problem was that I was not putting a space before the %c in my scanf function. But even after I put the space, the program would still loop infinitely, and I'm not sure whether it is a problem with my recursive string function or the scanf function I am using. Here is the code: #include<stdio.h> #include<stdlib.h> main() { int getString(); int maxChar; printf("Maximum number of characters for this run? "); scanf("%d", &maxChar); printf("\nEnter no more than %d characters: ", maxChar); getString(); printf("\n"); } int getString() { char c; scanf(" %c", &c); if(c != '\n') { getString(); printf("%c", c); } } As this is a homework assignment for a C class, I am not allowed to use strlen() or any other special functions. I can only use functions that I define myself (besides basic ones like printf() and scanf()). The program I have right now will take a string that the user enters and print it backwards, but only if I get rid of the scanf for the maxChar variable. Here is what the normal output looks like when it is working properly: And here it is with the new scanf function: The program will get hung here, I assume looping infinitely for some reason. If i remove the space in front of the %c in the getString() funciton, the program will crash after the max characters input like so: I assume this is not a crash but rather the program finishing after the scanf function in the getString() function reads the whitespace from the previous scanf and then cancels the if statement and prints nothing, terminating the program. I am not sure how to get around this, as we are not supposed to keep the main function relatively empty and use our own defined functions to scan user input. EDIT: I've been messing around with the program a bit just trying to get an external function which can read user input and then store it in the string array, however I have been getting a segmentation fault when I run the program. Here is the code: #include <stdio.h> main() { int getString(int maxCharacters, char characterArray[100]); int reverse(); int isPalindrome(); int maxCharacters = 0; char characterArray[100]; char programLoop = 'y'; do { printf("Maximum number of characters for this run?\n"); scanf("%d", & maxCharacters); printf("The maximum number of characters is %d\n", maxCharacters); getString(maxCharacters, characterArray); printf("Run the program again? (y/n)\n"); scanf(" %c", &programLoop); } while(programLoop == 'y'); } int getString(int maxCharacters, char characterArray[100]) { printf(" Enter no more than %d characters: ", maxCharacters); scanf(" %s", &characterArray); printf("%s\n", characterArray); } The result looks like this: I feel like its a problem in a way I am passing the characterArray array as an argument for the getString() function, but I'm not sure what I am doing wrong... Any advice would be greatly appreciated, Thanks!
  14. Haha well I'm not sure how the compiler for my class is but we are using the ANSI 90 version of C so it's pretty old Now I just have to finish my array assignment before tonight without using if statements and using only one variable besides arrays ¯\_(ツ)_/¯
  15. Oh that would have made it a lost easier in the first place! I messed around with do while before but I haven't really used it in any homework yet as I'm more comfortable with the normal while loops
×