Forgot your password?
typodupeerror
User Journal

Journal: Circular dependencies in three languages 1

Journal by Sloppy

Here are six files for ya, showing a problem in 3 different scripting languages. What will they do?
--------- test1.php:
<?php
require 'test2.php';

define('SOMECONSTANT','hello world');

function foo() {
                return SOMECONSTANT;
}

echo foo(); echo "\n";

--------- test2.php:
<?php
require_once 'test1.php';

echo foo(); echo "\n";
--------- test1.py:
#!/usr/bin/python
import test2

SOMECONSTANT='hello world'

def foo():
                return SOMECONSTANT

print foo()
--------- test2.py:
#!/usr/bin/python
import test1

print test1.foo()
--------- test1.rb:
#!/usr/bin/ruby
require 'test2.rb'

SOMECONSTANT='hello world'

def foo
                SOMECONSTANT
end

puts foo()
--------- test2.rb:
#!/usr/bin/ruby
require 'test1.rb'

puts foo()
---------
Ok, scriptfiends, predict the output of these three commands:
php -q -f test1.php
python test1.py
ruby test1.rb

and then do some pasting and try it out. Match your predictions?

The PHP one bit me pretty hard today.

User Journal

Journal: One Too Many 2

Journal by Sloppy

I have a password written on a post-it note underneath my keyboard. Decades went by without this ever having happened, but now I have one of these. [rationalize]And I'm keeping the post-it, because it'll probably be months or years before I ever need that password again, so there's just no chance I'll be able to remember it (it's actually a pretty well-made password).[/rationalize] OTOH, I suppose I could just throw it away and then the next time I need it, ask someone for it again. [truth]But no, it amuses me that I've entered the ranks of people with passwords on post-its at their desks, so I'm keeping it, for that reason if nothing else.[/truth]

User Journal

Journal: Slashdot and the Social Sciences 1

Journal by porcupine8

Argh. I know that if you are reading this, you are probably some kind of scientist or engineer, if not by trade then at least in mindset.

You are probably not a social scientist. I am. There are not many of us on Slashdot. So please, take a moment and let me explain a bit about our work to you:

It's true, correlation does not imply causation. However, not every SS study is a correlative study. There actually are ways to measure causation. Even ones that don't require a perfectly randomized full experiment, which is very hard to do when dealing with human subjects and nearly impossible to do if you're trying to find out how things work in the real world rather than how they work within a particular laboratory setup. There are many methodological and statistical techniques for piecing apart the likelihood of a correlation pointing to causation.

In addition to that, plenty of studies that do not measure causation don't claim to be. Now, the press release put out by their university might. The random blogger who posted about it might. But that doesn't mean that the authors actually claimed to find causation with methodologies that can only find correlation. Generally, that kind of thing gets mentioned in the peer review process.

So please, the next time you see a psychology/behavioral/education/other social science study on Slashdot, do not automatically cry "Correlation does not imply causation!!" without even reading the paper or understanding their methodologies or what they actually did or did not claim. And REALLY do not use this as your entire justification for declaring the study completely illegitimate. You just sound like a creationist who has wandered into a discussion of evolution and yelled "But what about entropy???"

Television

Journal: multicast video: someone's finally doing it 1

Journal by Sloppy

I've long advocated that the future of video delivery should either be multicast, or old-school protocols like HTTP combined with caching at the ISP. (Why all ISPs don't run transparent Squids, I still don't understand.) Bittorrent just isn't the right way to do it.

Thanks to Freedom To Tinker I've just learned that someone is using multicast to deliver TV.

Except it's not available in my area, and still requires propriety DVRs/STBs, which I assume means that it probably uses DRM and therefore has massive interoperability problems.

But it's a start. I hadn't heard of anyone actually doing it, before now.

Programming

Journal: I can't believe this happened. I miss .. Pascal?! 1

Journal by Sloppy

I was writing a function in PHP4 and it kept getting bigger. It could use some splitting up for readability/testing/debugging purposes, although it didn't really need that to work. But then I realized I needed to reuse some sections of code, and since I hate duplicating code, those parts needed to be pulled out into their own functions.

But they needed access to the working set of local variables of the big function. Oh great.. do I pass all those vars by reference, making the argument list really long? Do I move all those variables into a struct (well, an associative array) and pass that?

These are, like, Programming 101 issues. Experienced programmers don't normally have to think about this stuff, because the right thing to do is just .. obvious.

Then I remembered that Pascal has the unusual (and rarely(*) needed) feature of nested procedures, where the sub-procedures can directly access the outer scope's local variables. It dawned on me: that would be incredibly convenient (and readable) in this case.

I wussed out and put everything into a class. It's not really oop (all this class does, is return a result) but that looked like the best way to deal, except now I have an ugly this-> in front of everything.

(*) I haven't programmed in Pascal (or anything like it) in over 20 years. Never really missed that feature until today.

Security

Journal: The ad business REALLY sucks 2

Journal by Sloppy

It's bad enough when you're actually serving the data from your own site but it's in some form where you can't audit it. That's one of the many reasons I hate Flash.

But even Javascript sucks, when you <script src="someothersite">. The moment you do that, you know that all sorts of horrible things can go wrong. You just have to have faith. Faith is what it comes down to. And it can be justified, I guess, because you can get away with it for years.

Until this morning when our webpage was only showing for a second and then the whole thing would then redirect to someone else's site. Adios, visitors.

(What actually happened: the domain we were including from, apparently expired and now any http request goes to a Network Solutions page, instead of returning a DNS error like it should. Fuck you, Network Solutions, as if we didn't already know you're evil and dangerous. But the same risk remains even if someone's domain doesn't expire; they can always serve a different script today than they did yesterday, and that script can do anything with the DOM that it wants to. There's no way to sandbox it.)

It's "standard practices" to include external scripts. Everyone does it. The ad people aren't techies; if I were to tell them, "uh, we don't want to include any external scripts that might change from load-to-load, and we also don't want to include any Flash crap unless we've compiled it from readable, auditable source ourselves," they would think I'm crazy. You know, one of those open source fanatics. They would say, "Gee, that's a shame you don't want the money," and go on sending the same dangerous ads to our competitors while we collect nothing.

Is it really an unreasonable weirdo religious fanatic position, to just want to be able to make sure that stuff will work and not do anything crazy? I don't think so. The fucking "standard practices" need to change, but how can one person do that? *sigh* I feel so powerless.

Encryption

Journal: The Mom Test 2

Journal by Sloppy

Out of the blue, I got an email from my mom. She's been corresponding with someone about some sensitive things, and asked how to encrypt her emails.

My writeup is 9 paragraphs long. *sigh* There's so way she's really going to be able to do all that without me eventually going over there.

This is on Mac OS X. Sheesh. A Unix that doesn't come with gpg out-of-the-box, and the preloaded mailer (mail.app) needs a hard-to-maintain 3rd-party hack just to get basic functionality: you call this "just works?"

I don't wanna turn this into a specifically-Apple flame (I know of another high-marketshare desktop OS maker that also makes some pretty shitty apps), so I'll just make this generic comment: mail encryption is a very fundamental thing and it's ridiculous for it to not be built into all desktops. That's like a web browser that can't talk https. The howto I sent to my mom should have been about key exchange issues, not installing plugins. It's a disgrace for any mailer to not have this. This kind of shit is half the reason crypto goes unused by so many people. It's a pain in the ass not just because of the complex concepts (e.g. learning how to exchange keys safely) but because the most highly-deployed apps don't even work as-is.

Programming

Journal: Remember when.. 1

Journal by Sloppy

..a character was a byte, and you always knew what that byte meant, and you didn't have to worry about what database library the script interpreter was compiled against, and in turn what character sets the database library was compiled with support for? Remember when what you saw on the screen was the same as the underlying data?

How I long for those days. *sigh*

Spam

Journal: Go Go Greylisting! 2

Journal by Sloppy
Wow, postgrey just got rid of 99% of my spam, before it gets to spamassassin, and with no false positives (any standards-compliant mailers can get through it). I should have done this ages ago.
Unix

Journal: I hate Unix schedulers 9

Journal by Sloppy

One of the things that annoyed the hell out of me when I made the "big switch" around 2000-2002 from AmigaOS to Linux, is the dynamic scheduling. I'm pretty sure I've bitched in my /. journal about this before, but I'm too lazy to go back and look.

Hey, when I "nice" a time-consuming process, I fucking expect it to not slow my computer down, no matter how CPU-intense it is. That's how it was on AmigaOS: I could run as many tasks as I wanted, and as long as I gave them a priority lower (or was it higher, damn I don't remember the specifics) than 0, it had absolutely no impact on the responsiveness of the computer, and anything that I ran at a normal priority, ran just as fast as it would if I hadn't been running those other tasks at all. That's the joy of an absolute scheduler: it starves the low-priority tasks, and as a user that's what I want.

But all the so-called "modern" systems after the 1980s, from OS/2 to Windows to Linux (and now Mac OS as of version 10) totally fuck this up.

My Mac here at work runs a long job every morning, that I have niced. When it's running, the whole damn machine feels sluggish and -- seriously -- I can out-type the speed at which my fucking keystrokes are appearing in this fucking web browser's textarea. It is so utterly ridiculous that a 1.5GHz machine can't run as fast as 50 MHz Amiga.

Niced processes should starve if there's anything better to do. Absolutely starve. That is a good thing, not a bad thing.

But can Unix have this? Nooooo, because something (I don't know what) might deadlock (at least according to Linus, when the topic comes up in the context of Linux). Well, get your locks sorted out, Unixheads, so that maybe someday Unix can run as fast as an Amiga that has a tenth of the processing power.

User Journal

Journal: Burn Forever, Golden West 2

Journal by Sloppy
Saturday night, I was headbanging to Ultimatum at the Golden West Saloon. Last night (Wednesday), I was right next door at the Launchpad, for The Dirty Novels, Lions, and SuperGiant. At a little before 1:00am this morning, I left, drunkenly staggering right by the Golden West, briefly glancing into the dark window (it was closed).

I would never see it again.

It's destroyed. A fire erupted at about 6 this morning (WTF happened?!). When I walked by it again on my way to work a few hours later, it was totally gutted. I could see right through the front of the building, out into the parking lot behind it.

So.. a bar burned down. What's the big deal? It's just a bar, right? No. This place was special. It was fucking gorgeous, easily the nicest-looking bar in Albuquerque. Classically decorated decades ago.. timeless. Red velvet-covered walls, chandeliers, tin roof, the Puccini opera posters -- they're gone.

I saw many many shows there, mostly metal. I particularly remember one snowy Tuesday night about 4 years ago, seeing my favorite local band, Wisdom of the Leech. I was the only fan who showed up, and they still played for me.

I had my first Bridgeport IPA there. It happened after I tried a "new" (at the time) awful-tasting cloyingly-sweet stout (I won't name names), and I had to wash the taste out of my mouth. "Do you have any IPAs?" I asked. I wasn't even a hophead at the time; I just wanted some bitterness. Mathias served me a Bridgeport and I fell in love with it. Over the next few years, I didn't even have to order; Ryan or Christine would see me and start walking to the right tap.

I've brought dates there, been shot down there, got "lucky" there, sulked there, and celebrated there. And rocked, rocked, and rocked.

Read the musicians' reactions at rocksquawk, see photos at The Alibi. KOB, New Mexico Business Weekly.

The Launchpad, next door and also damaged, is closed for a few months too. It will be back. Serious doubts about the Golden West, though, and even if they rebuild, it won't be the same. It was the one bar where the original fixtures will actually be missed. Every other place in this town was replaceable. That one wasn't.

Software

Journal: I just noticed something

Journal by Sloppy

I've had to write a bunch of bash scripts at work lately, and they're all long pipelines.

No threads, no shared memory, no dealing with (or even having to think about) race conditions, no complications. Just lots of processes connected with pipes.

But if I were to write the same stuff in a "real language," it probably wouldn't have been as parallel. I'd just have a big loop that does a bunch of things to one chunk of data at a time, instead of a bunch of processes at that do one thing at a time.

I wonder if there's something wrong with "real languages" -- something that the "Unix philosophy" got right, yet rarely trickles up into bigger apps, where you'd think there would be even more opportunity to parallelize, not less. Hmm.

User Journal

Journal: 0wning a Windows Network; A Practical Approach 1

Journal by pegr

Listen up, folks. I am about to share with you a practical way to own any corporate Windows network. Before you bitch, first let me tell you that I won't tell you anything you don't already know or is anything other than obvious. That said, this approach works 85-90% of the time. It is time tested. It works. I've done it many times. And if you try this outside of legitimate network vulnerability testing, I hope you go to prison for a long time. That said, on with the show...

First, the bigger the Windows network, the higher likelihood of success. You'll understand why in a moment.

Any company with greater than 100 workstations uses workstation images to deploy new machines. It's a fact of life. The trouble is, the machines are a bit too similar. No one thinks about the local Administrator account. Yes, the local admin account has the same password for every machine. This is the key. Sure, the local admin account password may change when they change the image. But more times than not, many/most/all local admin passwords will be the same.

Get access to a workstation. If you're a consultant, tell them you need one before you show up. That way, a nice fresh workstation will be waiting for you when you get there. If not, wait until everyone goes home and help yourself to one (or more). No matter. Get your hands on at least one.

Did you guess step two? Dump the hashes and crack them. If you're lucky, you'll have LANMAN hashes. If not, you'll have NT hashes. LM hashes fall faster than SCO's stock price. NT hashes can be cracked, but you better be prepared. Rainbow tables work for NT hashes too. Maybe you'll get lucky. Maybe you'll have a few hundred gigs of NT hash Rainbow tables. Whatever. Chances are good you'll have LANMAN hashes. (For you auditors out there, that's finding number two. Number one was common passwords for local Admin accounts.)

Step three is to see how many machines you can access with your new local admin password. Look up how to attach to other machines from the command line. Write a few batch files. You can test your newly stolen credentials against a couple of hundred machines in a few hours.

Find your Windows admin users. They may be smart enough to change the local admin passwords. With a big enough comapny, they won't all be smart enough. Keep plugging and keep good notes.

Review the file systems of the machines you can access. There may be some good nuggets inside. Maybe you'll find router passwords, maybe you'll find love letters to the admin's mistress. It's all valuable. (Keep good notes.)

When you find a Windows admin's workstation, bug it. You want to record all authentication sessions. There are many good keystroke loggers out there. If your paranoid, don't use them. Write your own.

Retrieve your Domain Admin creds and have fun. Make a new domain admin account. Call it something that fits in with the present members of the domain admin group. If the group is large (finding number four for you auditors), just make an account that looks natural. If not, make one that mimics another legit account. Many admins have extra accounts for whatever reason. If you see an account "bwilson", try "bwilson2". The admins will naturally think it belongs to Bill. Why did Bill make another account? Believe me, no one will ask him.

Obfuscation:

Change your mac address for each session. Better yet, change your network port.

Use another workstation you already own. Use an encrypted volume for your activities. Have the volume close after ten minutes of inactivity.

Steal the mac address of a lonely network printer. Use the printer's network jack too. Printers don't use 802.11x.

Use a wireless bridge. If they can't find you connected to a port, they can't find you.

Variations on a theme:

Tell the admin about the common local admin passwords. Chances are, he will make a job to run once a month to change all the local admin passwords. If the local admin passwords weren't all the same before, they are now. Be sure to thank him for making the vulnerability even bigger than it was before. (Hey Rob-The-Windows-Security-Guru: That one's for you, dumbass!)

Get stuck on a NetWare network? Consider yourself lucky. NetWare caches NDS credentials down to the local machine as a local user by default. Crack the local and you have NDS creds. Even if the NDS account is deleted, the local account stays, and may get you access to any machine the NDS user accessed when the account was active. I've accessed local workstations with two year old expired NDS accounts. Thanks Novell! (See what happens when you make interoperability with Microsoft a higher concern than security? With moves like that, you deserve to have Bill Gates eat your lunch.)

I will update this post whenever I feel like it, which may be never. If you have something to say about it, feel free.

-pegr

X

Journal: Mildly interesting 4

Journal by sanctimonius hypocrt

If I double-click in the space between two words in Firefox, X highlights both words. In an xterm and in Vim, it just highlights the space. In a properties dialog within Rythymbox, and in the Openoffice spreadsheet, whichever word is nearer the cursor gets highlighted.

Update: I've come to use this whenever I want two words in Firefox, which is pretty often. So now it's a feature.

Media

Journal: Motherfucker!! 2

Journal by Sloppy

I work at a place that runs a fairly (locally) popular website. We sometimes get orders for ads from a company who just gave us one of these to run. I gather that the behavior in question is intermittent, so it was just dumb luck that it happened to me, so that I realized WTF was going on and killed it.

So they aren't screening this stuff, huh? That means I have to? Shit. I don't know how to screen for this. I hate Flash. I hated it before, but now I really fucking hate Flash.

Remember the good old days, when CPU was singular?

Working...