There are two potential sources for Lex to know that Kara is Supergirl, other than his own genius.
Lillian Luthor knows, thanks to having had Kara's adoptive dad as a prisoner, and therefore could have told him.
Cat Grant knows. And it's therefore possible that Eve as her right-hand woman found out through Cat knowing, either directly or indirectly, and told Lex.
Other people who canonically know Kara Danvers=Supergirl off the top of my head
J'onn, Jimmy, Brainy, Winn, Nia, Kara's adoptive mom, Clark, Lois, real Hank Henshaw, Barry, Ollie and their respective crews, Mon-El and the rest of the Legion
Other people who formerly knew Kara Danvers=Supergirl but who have been mindwiped
Alex, Haley, the five or so DEO agents, the rando person who went to high school with Kara and Alex and kidnapped Alex to force Kara to break his dad out of prison.