OK, I am going to solve your problem, OP. But you must do exactly as I say or you won't get good results.
First, answer a couple questions for me. Do you have any cat trees or scratching posts for your cat? Also, do you actively play with your cat every day?
A few people have hit on part of the solution but you actually need to do a few things to nip this issue in the bud.
First, go to the pet store and purchase Feliway cat pheromones. It's a plug-in diffuser that is full of odorless cat pheromones that will make your cat content and calm. It is not a drug and it is harmless to animals and humans. The Feliway contains the happy pheromones that cats produce in their facial glands and that they leave behind when they rub their faces on something.
Next, buy the cat toy at the link provided. It's called Cat Dancer and there are no substitutes. It's $2 bucks and the dumbest-looking toy in the world. But I swear to you, cats LOVE this toy. It activates and satiates their hunting instincts. Also, get another string toy, like the one linked at R12, so you have a little variety. You must play with your cat daily, at least 10 minutes a day. Ideally, if your cat is a solo cat, do a couple of play sessions each day.
After you play with your cat at the same time every day, feed her immediately. That is regular cat behavior: hunt, kill, eat. Then she will bathe and sleep.
Finally, if you do not have scratching posts or a cat tree, get your cat one. Cats need to climb. Maybe you have some bookshelves that you can arrange in a way where your cat can jump on top. This can stand in for a cat tree.
OP, if you can do these things for your cat, she will be happier and will not be interested in attacking your legs.