It depends on what kind of license it is: if it's an end-user license, then yes, you do (in theory) have to abide by it.
You're right that if it's just a copyright on the source code, then it's probably a restriction on redistribution, which means you couldn't _use_ that code for evil and then share it with others. But using it for evil for yourself: totally fine.