do you know a method to where in, I can write a piece of code within Android, to scan through a user's O.S for flaws which can lead toward a DoS attack etc.?
Assuming you want code that detects these vulnerabilities, it wouldn't make sense because why wouldn't Google's world class engineers run this code to detect these vulnerabilities themselves?
I think the best way to approach your problem is map known vulnerabilities (perhaps this may help) to versions of Android prior to that patch.
Therefore your code simply detects the user's Android version, and lists previously discovered vulnerabilities.
This isn't a silver bullet solution however because just because a security vulnerability was fixed in 4.1, doesn't mean it existed in all previous version of Android. Maybe it was only 4.0 that was vulnerable.
EDIT:
Here is a website that may help you in mapping vulnerabilities to Android versions.