I've been attacked numerous times why bicycling.
1. was sucker punched while bicycling very slowly on a downtown sidewalk by a 11 or 12 year-old kid. I was a pretty weak punch.
2. had a group of teenagers attempt to steal my bike while I was walking it and talking on my cell phone. I punched one of them in the nose while still holding the phone, which broke the phone, but they all ran off.
3. was ambushed late at night while biking up a hill by three teenagers. They pushed me into a parked car and I rolled my ankle while bailing from the bike (but didn't feel that until the next day). I realized that none of them could ride a bike since one of them threw my bike at me, which broke the seat. The big loss in this incident wasn't my wallet, which had a grand total of about $20 in it, but my new eye glasses which were punched off my face and run over by a car. They cost about $400 to replace. The only reason I gave them the wallet was because they claimed they had a gun, but they never flashed it.
4. a week after incident 3 I was riding at night near a hospital and was chased on foot by a guy who was about 20, but I was able to ride away without him reaching me.
Much scarier than any of these incidents were my many run-ins with loose dogs. I have been bitten twice, once in the heal and another time just below the ankle. The scariest dog was a mad dog in Kentucky. I had never seen a mad dog before but there was no mistaking it when it appeared from nowhere and ran at over 20mph after me. I was on a commuter bike, not a road bike, so I was barely able to stay in front of it. Then it randomly veered off to chase an imaginary object.
The big problem with dogs is when you're going uphill. If they want to bite you, you're a sitting duck. Sometimes they look like they're contained by a farm's fence but they'll run to some spot where they can get under it.