Jason Cooper

Active Members
  • Content count

    513
  • Joined

  • Last visited

  • Days Won

    8

About Jason Cooper

  • Rank
    Hak5 Ninja

Contact Methods

  • ICQ
    0

Profile Information

  • Gender
    Male
  • Location
    Great Britain
  • Interests
    Cards,
    Computers,
    Cryptography,
    Hacking,
    Lock Picking,
    Programming,
    And many more
  1. That looks very odd to me, as when I try it in powershell it works fine. PS > $folderPath="\\server\folder1\folder2\~folder3" PS > $splitFolder = $folderPath -split '\\' PS > echo $splitFolder[2] server PS > echo $splitFolder[3] folder1 PS > echo $splitFolder[4] folder2 PS > echo $splitFolder[5] ~folder3 In fact if I ask for an array index that doesn't exist I still don't get the error PS > echo $splitFolder[6] PS > I can get the same error you get by misspelling the variable name (e.g. by dropping the 'e' in folder) PS > echo $splitFoldr[6] Cannot index into a null array. At line:1 char:1 + echo $splitFoldr[6] + ~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : NullArray I'd suggest check the spelling (though I can't see any difference in your example) and trying again.
  2. Have you tried using something like: grep -orEH "(sub|new)" * | sed -re's|^([^:]*):(.*)$|\2:\1|' | sort The sed part switches the file name and matched keyword round so that the sort can then sort the output into keyword order. If you don't want duplicates to appear then simply pipe the output through uniq (if you supply uniq with the -c option then it'll give you count of how many times that keyword appears in that file).
  3. Could well be a distro thing, I've tried it in a CentOS 6 based distro and a debian wheezy based distro, and both use HWaddr.
  4. If you know your device's MAC address you can use something like ifconfig | grep "HWaddr XX:XX:XX:XX:XX:XX" | cut -d' ' -f1 Just remember to replace the XX:XX:XX... with your device's MAC address
  5. You probably want to add an input element to your form so that the user can can enter a username of the person they want to make the friend request with, then you'll have a username you can use to look up a user_id from your registeredusers table. Also, while Xorifelse's comment on stack overflow could have been worded better, it is definitely worth learning about parameterized queries (better to learn good habits to start with than have to unlearn bad ones later).
  6. A quick description of what your social network does (or what you want it to do) would be helpful, otherwise we'll just be making broad statements that may or may not be useful, or even correct in the context of your social network. For example, a social network where people join groups and post messages to those groups would require different design to one where users choose to follow others and see everything those others post. Also the underlying technology would be useful to know, e.g. does your PHP use a relational database, a NoSQL database, flat files, etc?
  7. Actually it does explain why it worked, but I'll go into it in a bit more depth. When using the $Group in double quotes it stringifys the value of the object so we have four strings @{Name=@Testone} @{Name=@Testtwo} @{Name=Testthree} @{Name=Testfour} The regular expression the OP provided as a solution is looking for an @ symbol followed by a character that is in the range or a - z, A - Z or 0 - 9. While all four strings start with an @ symbol those are immediately followed by an open brace '{' which doesn't match the pattern that the regular expression is looking for. The first and second strings have another @ symbol which does match the pattern as they're followed by the letter 'T' which is in the range being matched. The OP's solution however doesn't actually meet the criteria of only matching groups starting with an @ symbol as any groups that contain an @ symbol in the middle of their name (e.g. Test@five) as it will be matched by the "`@[a-zA-Z0-0]" regular expression as well.
  8. Seeing your output suddenly makes it all make sense. The $group variable isn't a simple string, it's actually an object with a Name property. When you put it in double quotes Powershell produces a stringified version of the object, which starts with the @ symbol (e.g. "@{Name=@Testone}". You then do a regular expression match against that string, which sees the first character as the @ symbol, which is matches what it's looking for exactly. I don't have access to an active directory to test, but try matching against the $group object's Name propery instead, e.g. $y = Get-ADuser JOEBLOGGS -property MemberOf | % {$_.MemberOf | Get-ADGroup | select Name | sort name} foreach ($group in $y) { if ($group.Name -match "^@") { echo "yep $group" } else { echo "Nope $group" } }
  9. Doesn't -match take a regular expression? If so have you tried "^@" to match a string starting with the @ symbol? What's really interesting though is that you got it returning true for all your groups whether they contained an @ symbol or not, which is something I haven't been able to recreate. e.g. $x = @("@test", "test2", "asd@test3"); foreach ($group in $x) { if ("$group" -match "`@") { echo "yep $group" } else { echo "Nope $group" } } results in yep @test Nope test2 yep asd@test3 while $x = @("@test", "test2", "asd@test3"); foreach ($group in $x) { if ("$group" -match "^@") { echo "yep $group" } else { echo "Nope $group" } } results in yep @test Nope test2 Nope asd@test3
  10. Try #/bin/bash # references the interface wlaninterface=wlan0mon # sets the base file name for the wireless survey recon=scouted # sets the file name for the pcap file to write too pcapfile=DaCapFile # sets the lenth of time to run the survey for - in seconds recontime=30s # sets the lenth of time to run the packet capture for - in seconds capturetime=600s # general house cleaning to remove previous captures rm $recon*.csv &> /dev/null rm $pcapfile*.cap &> /dev/null # setting wlan0 into monitor mode airmon-ng check kill airmon-ng start wlan0 # running the wireless survey airodump-ng -w $recon --output-format csv $wlaninterface &> /dev/null & sleep $recontime kill $! # finds the open WiFi network with the most active traffic and get the channel number channel=$(grep -a 'OPN' $recon*.csv | sort -nrk11 | tail -1 | awk '{print $6}') # removes the comma from the output of the previous line ch=${channel::-1} #finds the open WiFi network with the most active traffic and get the ESSID network=$(grep -a 'OPN' $recon*.csv | sort -nrk11 | tail -1 | awk '{print $19}') # removes the comma from the output of the previous line ssid=${network::-1} #running the packet capture airodump-ng -c $ch --essid $ssid -w $pcapfile --output-format pcap $wlaninterface &> /dev/null & sleep $capturetime kill $! The only change made is that I've moved the house clearing and survey parts so that they run before the you process the survey results. I suspect that in your earlier testing you had an old recon file present which it then used and as the script leaves the recon file on the filesystem at the end you'd only encounter the issue when you moved the script across but not the recon file. The good news is that this bug actually highlighted a logic bug that would be very difficult to spot otherwise (the logic bug was that each time it ran it was using the recon file from the previous time you ran the script not this time, which if you've changed locations wouldn't be much use).
  11. I assume that when you say that it's an array of strings you have something like var messages=[ "message 1", "message 2", "message 3" ]; If it is then the chances are that it's not so much an error caused by the missing semi-colon as a string containing an unescaped quote that's terminating the string too early. I don't think a debugger would help much as it is an error at the compiling stage. Have you tried running jshint against the code? It may narrow down the error a bit more. If jshint doesn't help you track down the source of the problem you could always fall back on a good old binary search to find the source of your problem. Simply comment out the first half of your strings in the array and see if it the error goes away, if it does you know the error is in the first 7,000 strings, if it doesn't you know it's in the last 7,000 strings. Then repeat the process on the block of 7,000 strings with the error in to narrow it down to 3,500 strings, repeat again to narrow it down to 1,750 strings, and keep going till you've narrowed it down to a number of strings that you can actually look at manually.
  12. If you're combining awk, sed and cut together and you're planning on using the code in the long term then you'd probably want to be considering moving over to a Perl or Python script instead for that part, as it will be easier to maintain. I'm not sure on the exact layout of your CSV file, but something like the following might produce the result you're after (you'll probably have to tune the field numbers being used to extract the $bssid and $ivs variables). #!/usr/bin/perl use strict; use warnings; my $maxIVs; my $maxBSSID; while (my $line=<STDIN>) { my @field = split /\s*,\s*/, $line; my $bssid = $field[0]; my $ivs = $field[10]; if (!$maxIVs || $ivs > $maxIVs) { $maxBSSID = $bssid; $maxIVs = $ivs; } } print "$maxBSSID"; If you make the script executable then you can use it in a bash script to populate a variable (you would probably want to change the path to match wherever you put the script). TARGET_BSSID=`./maxIV < test.csv`
  13. Try using ! instead of % to delay the expression evaluation. @echo off setlocal EnableDelayedExpansion FOR %%Z IN (SDESK1 SDESK2 SDESK3 SDESK4) DO ( set UserID=%%Z echo !UserID! )
  14. you need to stop CMD from expanding the environment variables too early (i.e. before %%Z is populated by the for loop) try adding this before the for loop Setlocal EnableDelayedExpansion
  15. Are they acting as routers or switches? If they're acting as routers then you could connect to one and use traceroute to your main router's IP and see what IP's it goes through. You could also fire up wireshark and see what packets are being passed about.